JSON eXtended Notation read as "Jaxson", rhyming with the artist Michael Jackson. The purpose of JXN is to extend the current capabilities of JSON to cover more features of its mother language. It is equipped with a simplified plugin framework allowing developers to easily increase any functionality as per need basis.
Right now it has pre-built MacroPlugin allowing the governing language to do logic formulation, loops and subroutines. Since JXN is just an extension to the format, any language that can implement JSON can implement JXN and gain its scripting abilities. Right now this is very useful to Actionscript as for quite sometime already, AS has been lacking on Dynamic Evaluation which Javascript had it easy. The first release will be focusing on actionscript and javascript. Soon to follow will be Java and C#. For the future, PHP, LotusScript, Python...
Take a look at this example{ "author":"rvillaver", "pseudoFunction":task([ set("myVar",1234), set("testObj",create("Object")), set("testObj.testValue", add( get("myVar"), get("fooBar") ) ), result( get("testObj.testValue") ) ]) }
This is a valid JS string, even when you check it with jslint.com.
Just make sure you put a var a = { "author".... at the start since jslint requires a full statement.Here's how to parse it in Javascript/Actionscript:
JXN.installPlugin("",JXN.plugins.MacroPlugin); var context = new Object(); context.fooBar = 10; JXN.load("./test.jxn",context,{ onResult:function(evt){ var output = evt.result.pseudoFunction.run(); //output evaluates to 1244 } });
The paradigm JXN uses is a single "virtual context" space. Variables can be exposed from the outside world into the context, and from there manipulated by the JXN script. The extent of manipulation is just dependent on the governing language's ability of object graphing. Variables declared inside the script are also put into the same context thus allowing the outside world to retrieve variables created by the script. If the governing language permits, JXN can also call functions of objects exposed to it.
Copyright (C) 2007 JXN
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
Michael Jackson© is not affiliated with this project.
Gallium31.com