Skip to Content | Skip to Navigation


dojo.toJson

Status:Draft
Version:1.0
Available:since 0.9

Returns a JSON serialization of an object.

Introduction

This function takes an object and converts it to a String serialization of that object.

Examples

1
2
3
4
5
6
7
 // a simple object
 var obj = { a:"one", b:3, c:true };

 // convert it to a string:
 var data = dojo.toJson(obj);
 console.log(data, typeof data);
 >>> {"a":"one","b":3,"c":true} string

TODOC: Date objects in objects

See Also:

  • dojo.fromJson
  • dojo.objectToQuery