How to create formatted JSON in javascript

var obj = {
  Name: 'John',
  BirthDate: '1999-01-01'
};

var formattedJson = JSON.stringify(obj, null, "\t"); // Indented with tab

Advertisements