Created
November 19, 2014 14:50
-
-
Save shaunwallace/0b06df193f16c31baa65 to your computer and use it in GitHub Desktop.
JSON.parse()
This file contains hidden or 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
JSON.parse('{"foo" : "true", "bar" : "false"}'); // returns Object { foo : true, bar : false } | |
// returns Object {p: 10} | |
JSON.parse('{"p": 5}', function (k, v) { | |
if(k === "") return v; // if topmost value, return it, | |
return v * 2; // else return v * 2. | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment