Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including clarinet with all npm packages installed. Try it out:

var clarinet = require("clarinet") var parser = clarinet.parser(); parser.onvalue = function (v) { console.log("Value: " + v); }; parser.onkey = function (key) { console.log("Key: " + key); }; parser.onopenobject = function (key) { console.log("New Object, first key: " + key); } parser.oncloseobject = function () { console.log("Close Object"); } parser.onopenarray = function () { console.log("New Array"); } parser.onclosearray = function () { console.log("Close Array"); } parser.onend = function () { console.log('End'); } parser .write('{ "firstName": "John", "lastName": ') .write('"Smith", "age" : 25, "address" : { ') .write('"streetAddress": "21 2nd Street", "') .write('city" : "New York", "state" : "NY",') .write('"postalCode" : "10021" }, "phoneNum') .write('ber": [ { "type" : "home", "number"') .write(': "212 555-1234" }, { "type" : "fax') .write('", "number": "646 555-4567" } ] }') .close();

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

clarinet v0.12.6

SAX based evented streaming JSON parser in JavaScript (browser and node)

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free