-3

How to parse json Array please help I have json format like this. how to output in html using jquery ?

{"errors":[{"code":5,"message":"No message content"}],"status":"failure"}{"errors":[{"code":5,"message":"No message content"}],"status":"failure"}
Pavel_K
  • 10,748
  • 13
  • 73
  • 186
Harshad Patil
  • 100
  • 1
  • 14

1 Answers1

0

Because of incorrect JSON format you have to convert this data to JSON format. Then JSON format will be like below

[
 {
   "errors":[{"code":5,"message":"No message content"}],
   "status":"failure"
 },
 {
   "errors":[{"code":5,"message":"No message content"}],
   "status":"failure"
 } 
]

then if we named this json data as response you can alert as

alert (response[0].status);

or

   alert (response[0].status + ' : ' +  response[0].errors[0].message);
Dr. X
  • 2,890
  • 2
  • 15
  • 37