Skip to content Skip to sidebar Skip to footer

How To Parse Json Data, Using Javascript

Can someone please show me how I can get my JSON data and use it in javascript? My data looks like this... [{ 'id': '1', '0': '1', 'filename': 'CONFIG 1', '1': 'CON

Solution 1:

o = JSON.parse('your string here');
console.log(o);

http://jsfiddle.net/Lenuk/

Solution 2:

var obj = JSON.parse($record);
document.getElementById("hello").innerHTML =obj.id[0];

Solution 3:

Your syntax for JSON data is incorrect. Json data is enclosed within {} and not []. Still for parsing JSON data use json2.js library from the link.

https://github.com/douglascrockford/JSON-js/blob/master/json2.js

and use;

var myObject = JSON.parse(myJSONtext, reviver);

Post a Comment for "How To Parse Json Data, Using Javascript"