JSON decoding not working

This is my 3.txt file: json file

I don't know why it works when it only has 1 data and when it has more data it doesn't work.

This is my code:

code

+3


source to share


1 answer


Your 3.txt does not contain valid json. You need to adjust the sample string to be valid JSON by adding quotes around strings, commas between objects, and placing objects inside the containing array (or object). It should be something like this,

 [{"address":"+6161616","body":"asda","date":"1231"},
{"address":"+616sdfs6","body":"as3sda","date":"155231"},
{"address":"+6161616","body":"asda","date":"123551"}]

      



You can check if json is valid here .

+6


source







All Articles