A quick syntax for JSON objects. Heavily inspired by jsonic, but simpler.
$ npm install tinysonic --save
'use strict'
var tinysonic = require('tinysonic')
const encoded = tinysonic.stringify({
hello: 'world',
my: {
world: 'data'
}
})
console.log('Encoded: ', encoded)
// Encoded: 'hello:world,my:{world:data}'
const decoded = tinysonic.parse(encoded)
console.log('Decoded: ', decoded)
// Decoded: { hello: 'world', my: { world: 'data' } }
Parses a tinysonic encoded string. Returns null
if it fails parsing.
Stringifies a js object into a tinysonic string. Returns null
on error.
Alternative for tinysonic.parse()
The full syntax is:
:
,
null
true
and false
{
and }
MIT