good afternoon, I am trying to access this JSON with Javascript using JSON.parse(json);
json = '{"ticket":{"Test":{"Nombre":"PRUEBAS","Sitio":"PRUEBAS","Tomo":"43","Cobro":"10629970","Fecha":"08\/05\/2019","Hora":"08:51 PM","MontoTotal":"4.00","Tipo":"Original"},"Causas":[[{"Nombre":"NACIONAL","Codigo":"Codigo","Hora":": 08:51 AM","Monto":"4.00","Hojas":[[{"Hoja":"1","Letras":"55"},{"Hoja":"2","Letras":"23"}]]}]],"Footer":{"Footer1":null,"Footer2":null}}}';
I have only been able to access the Test index and manage all the items inside it using json.ticket.Test.Name.
But when I try to access the Causes index, all I get is Undefined.
I'm trying with json.ticket.Test.Causes[index number]
I appreciate any kind of help!
As far as I could see Causes it is not where you are asking for it here I put a photo for you to understand it better
It means that to access Causes , it would be through:
And as in Causes, what there is is an array of arrays to obtain the first serious cause with:
Sometimes the handling of the JSON can become somewhat confusing, especially if, as in your case, they have a considerable depth. In these cases I usually use a JSON parsing Web tool , which, in addition to showing it more clearly, helps you to validate if the JSON is well formed.
In this way, you could access the name of the cause as follows: