Warning: Use of undefined constant Symbol - assumed 'Symbol' (this will throw an Error in a future version of PHP) in /mnt/new-ebs/workbench-106550/lib/dojo/util/docscripts/lib/parser2/dojo2.inc on line 215 Warning: Use of undefined constant JavaScriptSymbol - assumed 'JavaScriptSymbol' (this will throw an Error in a future version of PHP) in /mnt/new-ebs/workbench-106550/lib/dojo/util/docscripts/lib/parser2/dojo2.inc on line 215

dojo/_base/json.js

  • Provides:

    • dojo._base.json
  • Requires:

    • dojo.lib.kernel in common
  • dojo.fromJson

    • parameters:
      • json: (typeof String)
        a string literal of a JSON item, for instance:
        <code>'{ &quot;foo&quot;: [ &quot;bar&quot;, 1, { &quot;baz&quot;: &quot;thud&quot; } ] }'</code>
    • returns
      Object
    • summary
      Parses a [JSON](http://json.org) string to return a JavaScript object.
    • description
      Throws for invalid JSON strings, but it does not use a strict JSON parser. It
      delegates to eval().  The content passed to this method must therefore come
      from a trusted source.
    • type
      Function
  • dojo._escapeString

    • parameters:
      • str: (typeof String)
    • summary
      Adds escape sequences for non-visual characters, double quote and
      backslash and surrounds with double quotes to form a valid string
      literal.
    • type
      Function
  • dojo.toJsonIndentStr

    • type
      String
  • dojo.toJson

    • parameters:
      • it: (typeof Object)
        an object to be serialized. Objects may define their own
        serialization via a special &quot;__json__&quot; or &quot;json&quot; function
        property. If a specialized serializer has been defined, it will
        be used as a fallback.
      • prettyPrint: (typeof Boolean)
        if true, we indent objects and arrays to make the output prettier.
        The variable <code>dojo.toJsonIndentStr</code> is used as the indent string --
        to use something other than the default (tab), change that variable
        before calling dojo.toJson().
      • _indentStr: (typeof String)
        private variable for recursive calls when pretty printing, do not use.
    • returns
      null|String
    • summary
      Returns a [JSON](http://json.org) serialization of an object.
    • description
      Returns a [JSON](http://json.org) serialization of an object.
      Note that this doesn't check for infinite recursion, so don't do that!
    • example
      simple serialization of a trivial object
      	var jsonStr = dojo.toJson({ howdy: "stranger!", isStrange: true });
      	doh.is('{"howdy":"stranger!","isStrange":true}', jsonStr);
    • example
      a custom serializer for an objects of a particular class:
      	dojo.declare("Furby", null, {
      		furbies: "are strange",
      		furbyCount: 10,
      		__json__: function(){
      		},
      	});
    • type
      Function
  • dojo._base.json

    • type
      Object
  • dojo._base

    • type
      Object
  • dojo

    • type
      Object