Created
December 21, 2011 15:38
-
-
Save creationix/1506454 to your computer and use it in GitHub Desktop.
sample usage for jsonparse.
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
'bar' | |
{ foo: 'bar' } | |
'Hello' | |
'World' | |
[ 'Hello', 'World' ] | |
1 | |
2 | |
3 | |
[ 1, 2, 3 ] | |
[ [ 'Hello', 'World' ], [ 1, 2, 3 ] ] | |
4 | |
5 | |
6 | |
[ [ [ 'Hello', 'World' ], [ 1, 2, 3 ] ], 4, 5, 6 ] |
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
var Parser = require('./jsonparse'); | |
var p = new Parser(); | |
p.onValue = onValue; | |
p.write('{"foo":'); | |
p.write(' "bar'); | |
p.write('"}'); | |
p.write("[[["); | |
p.write('"Hello","World"]'); | |
p.write(',[1,2,3],'); | |
p.write('],4,5,6'); | |
p.write(']'); | |
function onValue(value) { | |
console.dir(value); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment