Functiondojo.toJson

<script src="../../js/dojo.js"></script>
defined in dojo/_base/json.js

Returns a JSON serialization of an object. Note that this doesn't check for infinite recursion, so don't do that!

Usage

function (/*Object*/ it, /*Boolean?*/ prettyPrint, /*String?*/ _indentStr) (view source)
parametertypedescription
itObjectan object to be serialized. Objects may define their own serialization via a special "__json__" or "json" function property. If a specialized serializer has been defined, it will be used as a fallback.
prettyPrintBooleanOptional. if true, we indent objects and arrays to make the output prettier. The variable dojo.toJsonIndentStr is used as the indent string -- to use something other than the default (tab), change that variable before calling dojo.toJson().
_indentStrStringOptional. private variable for recursive calls when pretty printing, do not use.