Click here to Skip to main content
14,865,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I have JSON string a result output from a webservice response, I need to parse the string shown below and extract the data. The decode_json sub returns error when I pass this string says malformed json .... What am I doing wrong, should I be using something other than decode_json ?




CSS
{
          'return' => '{"ATTUID":"pm304a","GUID":"d353f542-43f6-421b-9573-4c9c39ce77e3","CHRONICID":420,"OUTPUTFORMAT":"json","USERNAME":"m91619","STATUS_SUB_CODE_NAME":"Active","SOURCESYSTEM":"Oasis","STATUS_NAME":"Open"}'
        };



This is the error I get on decode - "Malformed JSON string neither array, object, number, string or atom,......"
Posted
Updated 28-May-15 6:54am
v3
Comments
Richard Deeming 28-May-15 13:09pm
   
That's not a JSON string. In JSON, properties are represented as name : value; your string has name => value instead.
pitmaster 28-May-15 19:09pm
   
well thats what I get from the response body, I need to trim the part beginning at '{ and ending at }' . Wonder if that would be treated as valid JSON string then.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900