Skip to content

Instantly share code, notes, and snippets.

@jbail
Last active December 10, 2015 01:58
Show Gist options
  • Select an option

  • Save jbail/4364238 to your computer and use it in GitHub Desktop.

Select an option

Save jbail/4364238 to your computer and use it in GitHub Desktop.
JSON parse and stringify example
var data = {
city: 'Denver',
state: 'Colorado',
lat: 39.737567,
lng: -104.9847179
};
data = JSON.stringify(data);
// 'data' is now a string that looks like...
// "{"city":"Denver","state":"Colorado","lat":39.737567,"lng":-104.9847179}"
data = JSON.parse(data);
// 'data' is now back to being an object.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment