yoppipipi yoppipipi - 1 month ago 7
PHP Question

How can I parse JSON in Php?

How can I get ioemks and wegraes?

ewewerw

I want to get something like this:

wewerwfe

Thank you!

Answer

Decoding a JSON String in php uses the json_decode functon, normally when decoing json with json_decode($json); it would return an object. But if you want to receive an array you would do: json_decode($json, true);.

json_decode(); is a strict function and will return null or nothing if the syntaxes are incorrect!

//Examples
json_decode('{"Something":"some_other_thing"}'); // Will return an object
json_decode('{"Something":"some_other_thing"}', true); // Will return an array
json_decode('{"something":"some_other_thing"'); // Will return NULL or NOTHING

As mentioned in user3019115's anwer: Take a look : JSON_DECODE

Comments