0

how to convert this json

[{"categories":[{"id":"171","name":"Fashion"},{"id":"219","name":"Blog"}]}]  

to

[{"id":"171","name":"Fashion"},{"id":"219","name":"Blog"}] 

for angularjs data binding

1
  • myObject[0]["categories"] ? Commented Feb 18, 2015 at 10:53

2 Answers 2

2

Your data is already in JSON format. You only require to read correct property.

var data = [{"categories":[{"id":"171","name":"Fashion"},{"id":"219","name":"Blog"}]}]  

var desired = data[0].categories; //Or data[0]["categories"]
Sign up to request clarification or add additional context in comments.

Comments

0
angular.fromJson(json);

Look here

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.