Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript print object pretty

//Prototype JSON.stringify(value[, function [, space]])
var myObject = {"hello": "world", "!": []};
var str = JSON.stringify(myObject, null, '	');//space may be a string or a number corresponding to the number of space

//What is displayed in the console
{
	"hello": "world",
	"!": [] 
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #print #object #pretty
ADD COMMENT
Topic
Name
2+3 =