sjson5
v0.1.7
Published
``` __ ______ |__| __________ ____ / ___/ | |/ ___/ _ \ / \ \___ \ | |\___ ( <_> ) | \ /____ >\__| /____ >____/|___| / \/\______| \/ \/ ```
Downloads
4
Readme
__
______ |__| __________ ____
/ ___/ | |/ ___/ _ \ / \
\___ \ | |\___ ( <_> ) | \
/____ >\__| /____ >____/|___| /
\/\______| \/ \/
sjson
Description:
sjson means serializable json. It is a rudimentry module for serializable json initiatives.
sjson is built on top of json resolving 2 dead lock features: function in objects and cyclic redundancy.
sjson allows you to put function source code in the object and parseJSON will convert string function to function in runtime.
e.g.:
var target={
a:1,
b:2,
theplusfunction:"#!function \
return o.a+o.b;"
}
var result1=sjson.parseJSON({sjson:target}).sjson;
sjson allows you to reference cyclic redundancy references as functions above at runtime.
e.g.
var target={
a:1,
b:2,
theplusfunction:"#!function return o.a+o.b",
file:"#!file test/data1.sjson", // file reference test/data1.sjson this reference uses fs.readFileSync
c:"#!reference theplusfunction" // c reference target.a this reference uses jsonPath
}
var result1=sjson.parseJSON({sjson:target}).sjson;
console.log(result1)
var result2=result1.c(target);
console.log(result2)
assert.equal(result2,3);