Hi Guys,

My problem was over decode a json which has false elements. Let me show,


$json =
'[{"active":true,"id":"6"},{"active":true,"id":"5"},{"active":false,"id":"1"}]';
print_r(Zend_Json::decode($json));

// Output is 
Array ( [0] => Array ( [active] => 1 [id] => 6 ) [1] => Array ( [active] =>
1 [id] => 5 ) [2] => Array ( [active] => [id] => 1 ) )

// What i need is
Array ( [0] => Array ( [active] => 1 [id] => 6 ) [1] => Array ( [active] =>
1 [id] => 5 ) [2] => Array ( [active] =>0 [id] => 1 ) )

The main problem is 3. active element is null. I search the problem and i
learn that if a json isn't valid, json_decode return NULL. But i check the
json from jsonlint.com and it is valid. 

Do you have any idea over the problem and solution.

Best Regards.

--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Json-decode-and-false-null-problem-tp3340950p3340950.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to