relace double quotes to parse JSON in PHP
- by hunt
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