Skip to content

Latest commit

 

History

History
36 lines (29 loc) · 1017 Bytes

File metadata and controls

36 lines (29 loc) · 1017 Bytes

jquery.rainbowJSON

JSON pretty print, jQuery plugin. Takes JSON and makes it way more readable and colorful :) Also it adds folding. You can choose depth of the recursion and maximum children elements which will be printed. Similar to var_dump() in php.

Usage

$('.makeItNice').rainbowJSON({
    maxElements: 0, // maximum elements per object that will be printed (0 is unlimited)
    maxDepth: 0, // maximum depth for recursive printing (0 is unlimited)
    json: null, // json as object or in string format (if empty, html of the DOM object will be used)
    bgColor: '#F5FAFF' // background color of the div, which will be used for shading
});

Example

rainbowJSON in action

Options used in image above:

$('.makeItNice').rainbowJSON({
	maxElements: 7,
	maxDepth: 4
});

$('.makeItNiceGreen').rainbowJSON({
	maxElements: 3,
	maxDepth: 3,
	bgColor: '#D8FFF2'
});