Tuesday, 9 March 2010

Javascript Object Notation

I always find that persisting program settings is a pain. The windows registry is worse than useless, text files always cause parsing problems.

So I decided to write a general purpose library function that would take a dictionary and save it using a sort of Rebol like format like this:

[key: value otherkey: [k1: valueininnerblock]]

and so on.

After jotting down the syntax I realized that Douglas Crockford had already done something similar so I changed my implementation from Rebolish to JSONish. My purpose was simply to persist settings so the first version is not a good implementation of JSON but you might find it useful. The code is used in a little slide show application that I am playing with dd.vbp. The JSON part is in the tokens.bas module.

No comments:

Post a Comment

Blog Archive

Followers