Skip to content Skip to sidebar Skip to footer

Json.parse Not Able To Parse Valid Json Object

JSON.parse throws error when I try to parse a valid JSON object. My issue is i'm receiving data from webservice and sometimes it works with parse and sometimes it doesn't not sure

Solution 1:

What you have there is a JavaScript object. It doesn't need to be parsed because it's plain JavaScript syntax and JavaScript itself parses it. JSON is a serialization format.

The JSON.parse() method takes a string argument, like one retrieved from an ajax call or from local storage or some other source of data that only deals in string values.

Solution 2:

Your JSON is malformed. A right JSON is

{"Result":"Inprogress"}

You have forgotten the "" character in beginning and in end of each part of your JSON.

Post a Comment for "Json.parse Not Able To Parse Valid Json Object"