|
Project Information
|
It is a small but powerful JSON library written in Javascript. In order to provide "prototypal chainability", it extend the object prototype to add a new method call "$" which can set/get any properties of a JSON object. The JSON to String and vice versa conversion is very simple. Features- Convert JSON into String
- Convert String into JSON
- Support Javascript Native Type: Date, RegExp
- Add a property function called "$" which extends any property into chainable setter/getter function
- 2K in file size
Basic UsageConvert JSON into String- Use the JS() method:
- var str={age:15,name:{firstname:"Peter",lastname:"Chan"}}.JS();
Convert String into JSON- Use the JSON() method:
- var obj='{age:15,name:{firstname:"Peter",lastname:"Chan"}}'.JSON();
Extend the properties of a JSON- var student={year:1}.$("result",{maths:100}).$(gpa:3);
- //student.result={maths:100}
- //student.gpa=3
Additional method- isArray()
- isBoolean()
- isDate()
- isFunction()
- isNumber()
- isObject()
- isRegExp()
- isString()
- each()
- item()
|