Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

What is the best readable json format with multiple lists

Hi,

I want to read a json file but I keep getting this error :

 

Details: "We found extra characters at the end of JSON input.

 

The file looks like this :

 

{"alerts": [{"country": "US", "nThumbsUp": 0}], "startTime": "2020-05-31 17:01:00:000", "endTime": "2020-05-31 17:02:00:000"}

{"alerts": [{"country": "SW", "nThumbsUp": 0}], "startTime": "2020-05-31 17:01:00:000", "endTime": "2020-05-31 17:02:00:000"}

{"alerts": [{"country": "SG", "nThumbsUp": 0}], "startTime": "2020-05-31 17:01:00:000", "endTime": "2020-05-31 17:02:00:000"}

 

So, between `}` of the first end and `{"alerts"` of second one, should I have delimiter such as `\n` or `,` or nothing at all?

How to make this kind of JSON file to be readable and preventing the above error.

 

  • Hi Anonymous 

    Thanks for amitchandak sharing.

    As tested, the json script is valid below.

    [{"alerts": [{"country": "US"}, {"nThumbsUp": 0}], "startTime": "2020-05-31 17:01:00:000", "endTime": "2020-05-31 17:02:00:000"},
    {"alerts": [{"country": "SW"},{"nThumbsUp": 0}], "startTime": "2020-05-31 17:01:00:000", "endTime": "2020-05-31 17:02:00:000"},
    {"alerts": [{"country": "SG"}, {"nThumbsUp": 0}], "startTime": "2020-05-31 17:01:00:000", "endTime": "2020-05-31 17:02:00:000"}]

     

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • v-juanli-msft's avatar
    v-juanli-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous 

    Thanks for amitchandak sharing.

    As tested, the json script is valid below.

    [{"alerts": [{"country": "US"}, {"nThumbsUp": 0}], "startTime": "2020-05-31 17:01:00:000", "endTime": "2020-05-31 17:02:00:000"},
    {"alerts": [{"country": "SW"},{"nThumbsUp": 0}], "startTime": "2020-05-31 17:01:00:000", "endTime": "2020-05-31 17:02:00:000"},
    {"alerts": [{"country": "SG"}, {"nThumbsUp": 0}], "startTime": "2020-05-31 17:01:00:000", "endTime": "2020-05-31 17:02:00:000"}]

     

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.