0

Using JsonEncode I got a php array in Javascript. How I can get the modified array back to php?

bpeterson76
12.9k6 gold badges51 silver badges82 bronze badges
asked Jan 2, 2010 at 11:57

2 Answers 2

1

As I understood you need json_decode() function. You can easily convert array encoded in json-format to the php-array

answered Jan 2, 2010 at 12:02
Sign up to request clarification or add additional context in comments.

1 Comment

That is, after you have submitted it to a php script via ajax or through a form submit.
0

To get a JSON string to a PHP object:

$obj = json_decode($some_json);
echo $obj->field1; // where field1 is a known field

TO get a JSON string to an associative array:

$arr = json_decode($some_json, true);
echo $arr['field1'];
answered Jan 6, 2010 at 23:19

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.