Parse and Display JSON to Browser

How to parse json with jquery and ajax

Developers always need some quick method to debug variables and object. When it comes to check values of a Json variable in JavaScript become a pain.

Recently I have came across the same situation where I have to view the values of a JSON variable. After a lot of searching I found the best solution. So sharing with all of you.

var test = {"first_name": "David", "last_name": "Beckham", "country":"England"};
var str = JSON.stringify(test, undefined, 2); // indentation level = 2

You can get more info on stringify function here.

Get the latest updates directly in your inbox for FREE: Subscribe here

Share your feedback / let me know your doubts regarding this tutorial in the comment box given below.


Shahrukh Khan (Hasan)

A software engineer who's a die-hard coder, blogger, dreamer and mentor with years of expertise in web development. Know more...

Related Posts

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.