0

I have to parse values from a json string like this:

[{"type":"list","value":["A","B"],"field":"scheda"}] 

How can I do that using PHP function json_decode?

For example I want print:

field = "scheda"
values = "A,B"

2 Answers 2

4
$json = json_decode('[{"type":"list","value":["A","B"],"field":"scheda"}]');
print 'field = "'.$json[0]->field.'"'."\n";
print 'values = "'.implode(",",$json[0]->value).'"'."\n";
Sign up to request clarification or add additional context in comments.

Comments

0

If you can't use json_decode(), why not try a class?

For instance, something like... http://www.phpclasses.org/package/4205-PHP-Serialize-and-unserialize-values-in-JSON-format.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.