Miscellanea menu
JSON for Javascript done properly
Class functionality, recursion, dates, regexps and other lacunae dealt with
CJC opens-up the possibility of persistent object-oriented programming with javascript
Built-in JSON fails
So much built-in fail
RequirementJSONCJC
Recursion
Functional objects
Dates
RegExps
null
NaN
undefined
Objects get gutted
myFunctionalObject.CallMyMethod(); // Works fine var dumbJson = JSON.stringify(myFunctionalObject); var mfo = JSON.parse(dumbJson); mfo.CallMyMethod(); // ARGHHHH! FAILS
Fixed with CJC
myFunctionalObject.CallMyMethod(); // Works fine var cleverJson = CJC.toJSON(myFunctionalObject); A string that can be stored etc. var mfo = CJC.fromJSON(cleverJson); mfo.CallMyMethod(); // Works HURRAH!
CJC is an esential bit of technology for anyone doing OO programming in Javascript.