[OPEN-ILS-DEV] Old JSON parser retired

Scott McKellar mck9 at swbell.net
Sat Aug 14 07:57:34 EDT 2010


As discussed yesterday, I have eliminated all traces of the old JSON parser from OSRF trunk.  These traces include the files osrf_json_parser.c and osrf_json_utils.c, and all references to them in other files.

One of the traces was one that I wasn't even aware of: Makefile.json.  This is an extra little Makefile for making a standalone library of the JSON routines.  It's there for anyone who finds it useful, but we don't use it, and Bill doesn't know of anyone who does.

If you use this standalone JSON library, the rest of this message is for you.  If you don't, you can stop reading now.

Makefile.json is likely to go away some day.  So if you'd like it to remain available, speak up.

Of all the parsing routines in the old parser, the topmost functions are:

    jsonParseString
    jsonParseStringRaw
    jsonParseStringFmt

These functions don't exist any more.  They have been replaced by their respective plug-in equivalents:

    jsonParse
    jsonParseRaw
    jsonParseFmt

To ease the pain, I added some macros to osrf_json.h, replacing calls to the old functions with calls to the new ones.  If these are the only features you use from the old parser, then a recompile should work just fine.  It would still be a good idea to recode the function calls, but you can do so at your leisure.

(Even with a good compile and link, it is possible that the new parser will give you problems.  It is much more strict about syntax checking than the old parser.  If your application is used to using invalid JSON and getting away with it, you may need to clean up your inputs.)

If you use anything else from the old parser -- calls to internal parser functions, or any of the macros and struct declarations from the old header file osrf_json_utils.h -- then there is no simple solution.

The only good reason I can think of for using these other bits and scraps is if you need to parse JSON incrementally -- i.e. you feed the input JSON into the parser piecemeal instead of all at once.  If you need an incremental parser, I recommend the one found in jsonpush.c.  However that will require rewriting some of your own code.

In the short run it may be useful to revive the old parser from svn and maintain it yourself locally.  In the long run that approach will merely defer the pain.

Scott McKellar




More information about the Open-ils-dev mailing list