2
I need to get a Json as follows:
{
"razao_social": "Loja do Zé LTDA",
"nome_fantasia": "Zé Store",
"tipo": "J",
"observacao": "Cliente com ótimo histórico de pagamentos.",
"emails": [
{
"email": "[email protected]"
},
{
"email": "[email protected]"
}
],
"telefones": [
{
"numero": "(11) 98765-4321"
},
{
"numero": "(47) 9876-5432"
}
]
}
The email would have to be an array?
What the code for that would be?
My Class
public class GetClienteBO
{
public int id { get; set; }
public string razao_social { get; set; }
public string nome_fantasia { get; set; }
public string tipo { get; set; }
public string cnpj { get; set; }
public string Inscricao_estadual { get; set; }
public string suframa { get; set; }
public string rua { get; set; }
public string complemento { get; set; }
public string cep { get; set; }
public string bairro { get; set; }
public string cidade { get; set; }
public string estado { get; set; }
public string observacao { get; set; }
public Email emails { get; set; }
public Telefones telefone { get; set; }
public bool excluido { get; set; }
}
public class Email
{
public string email { get; set; }
}
public class Telefones
{
public string numero { get; set; }
}
Code:
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void JsonTeste(string JsonChamada)
{
SerializerFO Serializer = new SerializerFO();
var Retorno = new GetClienteBO();
Retorno.id = 1;
Retorno.razao_social = "Loja do Zé LTDA";
Retorno.nome_fantasia = "Zé Store";
Retorno.tipo = "J";
...
Retorno.estado = "SC";
Retorno.cidade = "Joinville";
Retorno.excluido = true;
Retorno.observacao = "Cliente com ótimo histórico de pagamentos.";
Retorno.emails = ????
Retorno.telefones = ???
...
}
Yes. That is the question?
– Jéf Bueno
Also, I’d like to know how you would implement this?
– Igor Lessa
Implement what? You just played a JSON on the question =)
– Jéf Bueno
How would code kkkkk sorry XD
– Igor Lessa
Young man, what would the code be for? Create JSON? Do you already have the classes ready? What do you have ready?
– Jéf Bueno
I edited the post with my code, need to know how I will pass the values in emails and phones
– Igor Lessa