JSON: Difference between revisions

From air
Jump to navigation Jump to search
No edit summary
Line 13: Line 13:
birthday: new Date(),
birthday: new Date(),
email: "dd@moi.org",
email: "dd@moi.org",
phones: ["+33 123456789", "+33 653456789"],
};
};
var message = JSON.stringify(vcard);
var message = JSON.stringify(vcard);


var vcard2 = JSON.parse(message)
var vcard2 = JSON.parse(message);
</pre>
</pre>

Revision as of 09:16, 5 March 2013

JSON (JavaScript Object Notation)

http://www.json.org/

API

Java

http://code.google.com/p/google-gson/

Javascript & Node.js

    var vcard = {
  		lastname: "DONSEZ",
  		firstname: "Didier",
  		birthday: new Date(),
  		email: "dd@moi.org",
                phones: ["+33 123456789", "+33 653456789"], 
	};
    
    var message = JSON.stringify(vcard);

    var vcard2 = JSON.parse(message);