/console.json

Syntax Highlighting for JSON in the browser console.

Primary LanguageJavaScriptMIT LicenseMIT

console.json()

JSON syntax highlighting in the browser console :)

Useful for quick debugging!

Usage

console.json(value, depth, delimiter);
  • value

    The value to convert to a JSON string

  • depth

    The maximum depth to recurse through. Defaults to 7.

  • delimiter

    A String that’s used to insert white space into the output JSON string for readability purposes.

Example

console.json({
	'string': 'Hello World!',
	'boolean': true,
	'function': function() {},
	'number': 42,
	'null': null,
	'undefined': undefined,
	'array': ['a', 'b', 'c'],
	'object': {
		'caterpillar': 'butterfly'
	}
});

Result