How do I parse a json return where I have optional fields such as phone, the user can have more than one such as residential, mobile and phone to message, in this case if the user has informed the phone it list if I have not informed it does not list any or only one or two, follow the example of a return below.
{
"transacao":{
"codigo":1,
"nome":"bruno",
"sobrenome":"richart",
"idade":28,
"endereco":{
"rua":"Avenidas das Americas",
"numero":12300,
"bairro":"Barra da Tijuca",
"cidade":"Andradina",
"uf":"rj"
},
"telefone":[
{
"tipo":"residencial",
"ddd":18,
"numero":37236207
},
{
"tipo":"celular",
"ddd":18,
"numero":972770022
}
],
"compra":{
"idproduto":23,
"descricao":"Celular Iphone",
"quantidade":1
}
}
}