relace double quotes to parse JSON in PHP

Posted by hunt on Stack Overflow See other posts from Stack Overflow or by hunt
Published on 2010-04-20T11:42:13Z Indexed on 2010/04/20 11:43 UTC
Read the original article Hit count: 218

Filed under:
|
|
|

hi,

i have following json format

{ "status": "ACTIVE", "result": false, "isworking": false, "margin": 1, "employee": { "111": { "val1": 5.7000000000000002, "val2": "9/2", "val3": 5.7000000000000002 }, "222": { "val1": 31.550000000000001, "val2": "29/1", "val3": 31.550000000000001 } } }

how the problem is when i am trying to decode above json response in php using json_decode($res,true) { true param for associative array } i am getting following result as few fields like "result":false is not "result":"false" i.e. at many of the places doubles quotes are missing in values of json. see in val1 and val3 fields

resultant data after decoding in php (associative array) Array ( [status] => ACTIVE [result] => [isworking] => [margin] => 1 [employee] => Array ( [111] => Array ( [val1] => 5.7 [val2] => 9/2 [val3] => 5.7 ) [222] => Array ( [val1] => 31.55 [val2] => 29/1 [val3] => 31.55 ) ) )

please help me on how would i insert double quotes in values ? Thanks

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about php