Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

readme.md

JSON

Working with JSON

  • Since JSON is nothing more than a string, it can be used to store data in a text file or transfer data via an HTTP requests between two machines.

JavaScript provides two methods for working with JSON.

  • The first is JSON.stringify and the second is JSON.parse.
  • JSON.stringify converts a JavaScript object into a JSON string
  • JSON.parse converts a JSON string into a JavaScript object

JSON.stringify

JSON.parse()

// will throw a SyntaxError
JSON.parse("{'foo': 1}");