jQuery.toJSON(object, compact, indent, depth)

Parameters:

Compact add spaces between elements in the json string? This setting is ignored when indent=true
Indent this setting allows for indented json formatting.
Depth 0 The depth paramater is used internally to recursively indent the json string, and to check whether the maximum recursion depth is reached.

Choose the javascript to convert to json:


The resulting json: