2

an array of server:

Array ( [28.01.2015] => Array ( [03] => 2 [02] => 4 ) )

was converted into a string using the json_encode.

The result was a string:

{"28.01.2015":{"03":2,"02":4}}

How to use Javascript to convert this string into an array ?

3 Answers 3

1

You can turn that into a JavaScript object by using JSON.parse():

var my_object = JSON.parse('{"28.01.2015":{"03":2,"02":4}}');
Sign up to request clarification or add additional context in comments.

Comments

1
JSON.parse('{"28.01.2015":{"03":2,"02":4}}');

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse

Comments

1

For achieve this, you need use JSON.parse.

JSON.parse('{"28.01.2015":{"03":2,"02":4}}');

Or you could organize better:

var string = '{"28.01.2015":{"03":2,"02":4}}';
var object = JSON.parse(string);

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.