Parsing & Object creation of json in javascript

Example to parse a json in javascript and accessing its object value.In json normally its  has the data in the format of  key/value pairs. Multiple datas are separated by commas.Curly braces holds object in json and square brackets holds array.

SYNTAX:

JSON.parse(json_data);

Expected Output:

 

Sample program for above output:
<!DOCTYPE html>
<html>
<body>
<h2>JSON Object Creation in JavaScript</h2>
<p id="codeexpertz"></p>
<script>
var json_data = '{"company_name":"codeexpertz","example_program":"json parsing"}';
var object = JSON.parse(json_data );
document.getElementById("codeexpertz").innerHTML =
object.company_name+ "<br>" +
object.example_program;
</script>
</body>
</html>
Category: 

Comments

Merle (not verified)
Hmm it looks like your website ate my first comment (it was super long) <br><br> so I guess I'll just sum it up what I had written and say, I'm thoroughly enjoying your <br><br> blog. I as well am an aspiring blog blogger but I'm still new to the <br><br> whole thing. Do you have any suggestions for rookie blog writers?<br><br> I'd genuinely appreciate it.<br><br> <br><br> My weblog ... <a href="http://www.majorsys.com/mobogenie-apk/">Majorsys.com</a>