Where can it be useful?
One of its use cases, and the reason why this library has been created, is that it provides an elegant solution to request data from APIs. In API world, especially REST API world, JSON format is one of the most common, lightweight and human friendly format available, and it will probably stay around for another decade. Because of that, I believe that supporting Commodore 64 and other 8-bit machines with the versatile 6502 JSON Parser will bring new ideas, and actively help to develop modern software for our beloved, small, but still in some way powerful machines.
You could easily use this JSON parser with http64
library written by Doc Bacardi which allows to make requests over HTTP. You can find source code here: http://csdb.dk/release/?id=14611
library is used in HTTP-Load, and Singular Browser, and works perfectly with RR-Net ethernet cartridge, or other devices.
You can also use JSON parser to organize your data, or to keep your configuration on the disk or cartridge - or anything else you wish for!
- Any given length of JSON can be parsed, it also applies to value length.
- Static or stream parsing mode: JSON object can be downloaded at once before parsing, or can be parsed from open stream which can be useful for heavy responses.
- With just one line of code, it's an easy way to store array of strings, or integers in a table, without memory constraints.
- Escaped characters are supported for keys, and values (e.g. quotes escaped by backslash character).
- Option to convert ASCII characters to PETSCII, so they can be displayed on screen straight away.
- Possibility to store not only values, but also keys (including length of these values and keys).
- No zero-page addresses occupied (though it's configurable to do so), so you don't have to care about reserving one, and avoiding variable collisions.
- Keys length is limited but configurable (up to 256 bytes).
6502 JSON Parser
library contains unit tests written with ours c64unit
unit test framework.