Home » Company » Sample applications » The JSON Parser

The JSON Parser

In mid-January 2009, at a Data Access partner meeting in Barcelona, a group of us were given early sight of the not-quite-finalised list of features being considered for inclusion in the forthcoming release of Visual DataFlex: the 2009 15.0 version. This prompted the first thoughts about the The JSON Parser.

Almost the first question that Sture Andersen and I asked was “Could we have a JSON interface to VDF’s web services?“.  In fact it turned out that such a feature was already on the list as being under consideration – it just wasn’t on the first page of the spreadsheet at that point.  In response, over the next few weeks, Data Access solicited the opinions of a number of us – christened at the time the “JSON-heads” by John Tuohy – as to what form such a feature might take.

Although we didn’t get everything we wanted, the ability of VDF web services to return their data in JSON format did make it into the product, since it turned out that this aspect was technically very simple to implement (on the order of one man-day’s worth of development if I remember the details correctly).

In response to a question from Eddy Kleinjan of Data Access Europe, John, as a better alternative to writing a technical explanation of how JSON data might be parsed in Visual DataFlex, wrote a small JSON parser that actually did it.  It only took him (he told us at the time) around four hours to write (if you take a look at it that will give you some idea of just what an extraordinarily productive developer John is!) and in his own words was “not complete“.

It was however a very good start.

At the time I took it and changed a few things and fixed a few bugs.  I have found other bugs since and fixed those as well.  At time of writing it is still not perfect: it only accepts JSON objects as the outer container, not arrays, which are also technically permissable, and its error reporting is weak to non-existent.  That said, it does – with the proviso about not handling arrays understood – seem capable of dealing with any piece of JSON data I have asked it to parse.