JSON stands for JavaScript Object Notation, and if you dig through the source, you'll quickly realize that JSON is the preferred format of choice for FlowBasis. JSON is easily usable from client-side javascript or within PHP on the server. It's the format objects are transmitted in from the client to the server and back again for remote procedure calls (AJAX stuff), and it's the format of objects saved in the FlowBasis object store.
A sample JSON object declaration might look like (in Javascript, the quotes aren't required around "username" or "favoriteNumbers"):
{ "username" : "bob", "favoriteNumbers" : [42, 37, 100] }
In PHP, this could be declared as:
$bob = new stdClass;
$bob->username = "bob";
$bob->favoriteNumbers = array(42, 37, 100);
and it could be converted to JSON with:
$json = json_encode($bob);
But, usually, the FlowBasis infrastructure will convert the PHP object into JSON where needed.



Add Comment