I need a JSON, JS Array parser in Java and/or PHP. Do you know any parser ?
regards,
I need a JSON, JS Array parser in Java and/or PHP. Do you know any parser ?
regards,
PHP can decode JSON objects already... use json_decode()
.
$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
var_dump(json_decode($json));
json.org lists a whole slew of them for both languages.
The java one is here: http://www.json.org/java/index.html
PHP 5.2 has it bundled already.
json_decode() and json_encode() will do the trick, as long as your text is UTF-8.
FlexJson is not too bad for Java, it even allows for typing of the JSON. I didn't really like the json.org Java libs serialization, it required a lot of coding.
If you are using PHP >= 5.2, you can use json_decode
(as said in other answers).
In PHP 5.1.x, I have successfully used Zend_Json
both to encode and decode JSON data -- it does not require the whole Zend Framework to work (If I remember correctly, it requires Zend_Exception
, and that's it)