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 @myc90/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.