How to Write Json in JavaScript Posted in Polyglotbits on 13 of Aug, 2015

Since json is short for JavaScript Object Notation - it does not come as a surprise that is a natural part of the javascript language. The JSON module has two methods that you’ll use all the time when working with rest (both server and client side). JSON.parse makes a json string into a JavaScript object, and JSON.stringify makes a JavaScript object into a json string.

var person = {
  name: "Claus Witt",
  type: "Humanoid",
  tags: ["awesome", "lazy"]

var json = JSON.stringify(person);