dojo.toJson

Available:since V0.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

Error in the documentation? Can’t find what you are looking for? Let us know!