Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-03-2011, 11:13 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
A history of disappointment: part III

23-08-2006 I release parseXML() code
13-07-2007 Stefan releases the client with XML support

09-06-2007 I release gsSQL system
09-08-2007 Stefan mentions that there is support for MySQL in some places
---------- Later, we have SQLite.

25-10-2011 Stefan releases new client (for Mac) with JSON support
03-11-2011 Release of the Windows client with JSON support
03-11-2011 Here I am, releasing the JSON parser that I made last year that I've been hiding away...



json: the basic features are the ability to create a JSONObject attached to the thing joining the class (this.JSON) via this.open(fileid) and save it back to a file via this.update(). You can parse arbitrary JSON with the parse function but I've never used it directly as it's just a wrapper for JSONObject.initjson(). You can serialized JSONObjects with stringify(JSONObject), but it is just a wrapper for JSONObject.stringify().

jsondump: endows a JSONObject with the ability to be serialized via JSONObject.stringify().

jsongarbagecollector: done with that object? JSONObject.kill().

jsonobject: the meat of the parsing is done here. Call JSONObject.initjson(json) to do so. It is based loosely off of Douglas Crockford's JSON parser, but gets around the loop limit (somewhat).

It is very lax in the syntax. For example, anywhere that : or , is required in true JSON, this script will skip over those characters, assuming that you meant : or ,. Additionally, the terminal }, ], ", or ' at the very end of the JSON will be added for you (but I wouldn't rely on it). Doing open then update will fix any 'errors'.
Attached Files
File Type: txt json.txt (1.4 KB, 154 views)
File Type: txt jsondump.txt (2.1 KB, 150 views)
File Type: txt jsongarbagecollector.txt (1.1 KB, 152 views)
File Type: txt jsonobject.txt (6.2 KB, 170 views)
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/

Last edited by Tolnaftate2004; 11-04-2011 at 09:32 PM..
Reply With Quote
  #2  
Old 11-04-2011, 12:40 AM
haro41 haro41 is offline
zenkou
haro41's Avatar
Join Date: Jul 2003
Location: Sol Grotto
Posts: 689
haro41 will become famous soon enough
Send a message via AIM to haro41
can i use it to shot baddies.
__________________

Zenkou for life
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:19 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.