Created
May 3, 2016 15:31
-
-
Save PandelisZ/163acd98e73a97637b92aae4f468d910 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//You can use | |
var str = JSON.stringify(object) | |
//to serialize your objects to a JSON string and | |
var obj = JSON.parse(string) | |
//To read it back as an object. The string can be written to file. So, for example an object like this: | |
var p = new Foo(); | |
p.Bar = "Terry" | |
var s = JSON.stringify(p) | |
// write s to file, get => { "Bar" : "Terry" } | |
// read s from file and turn back into an object: | |
var p = JSON.parse(s); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment