Repository:
https://github.com/portify/jettisonDownload:
https://github.com/portify/jettison/archive/master.zipClone:
https://github.com/portify/jettison.gitJettison (v3.0.1)Jettison is a simple JSON parser in TorqueScript, which
should be standards-compliant in terms of JSON syntax and data types (supports null, bool, number, string, hash, array).
It can parse (into TS strings and objects), manipulate (editing parsed objects) and serialize (dump to JSON) arbitrary JSON data.
How simple?
%json = parseJSON("...");
if (%json $= "") return error("parsing failed");
// ...
if (isJSONObject(%json)) %json.delete();Null, booleans, numbers and strings are represented as you might expect.
Hashes and arrays are custom objects with simple access to the data they contain.
For the given JSON:
[
{
"id": 6693533,
"name": "jettison",
"full_name": "portify/jettison",
"owner": {
"login": "portify",
"id": 1732901,
...
},
"private": false,
"html_url": "https://github.com/portify/jettison",
"description": "A JSON parser written in TorqueScript.",
"fork": false,
"url": "https://api.github.com/repos/portify/jettison",
...
"size": 284,
"stargazers_count": 1,
"watchers_count": 1,
"language": "C#",
"has_issues": true,
"has_downloads": true,
"has_wiki": true,
"forks_count": 0,
"mirror_url": null,
"open_issues_count": 1,
"forks": 0,
"open_issues": 1,
"watchers": 1,
"default_branch": "master",
"master_branch": "master"
},
...
]It can be manipulated in the following way:
==>$j = parseJSON("...");
==>echo($j.item[0].description);
A JSON parser written in TorqueScript.
==>echo($j.item[0].owner.login);
portify
==>echo("GitHub" SPC ($j.item[0].has_wiki ? "is" : "is not") SPC "lying!");
GitHub is lying!Autogenerated documentation