6502 JSON ParserPrint page

Last updated: 2022-08-13
6502 JSON Parser is a library created to parse valid JSON objects, written in 6502 assembly for Commodore 64, or any other 6502/6510 8-bit machine.

You can find source code, and details about installation and usage here: https://bitbucket.org/Commocore/6502-json-parser

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. http64 library is used in HTTP-Load, and Singular Browser, and works perfectly with RR-Net ethernet cartridge, or other devices. WiC64 (the Wireless WiFi interface for C64, SX64, C128 and VIC20) is the other alternative that has HTTP support already implemented (as of August 2022, only GET method is being supported).

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!

Features.
  • 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).
  • Parser allows to store only relevant data.

6502 JSON Parser library contains unit tests written with ours c64unit unit test framework.




Copyright © 2011-2024 Commocore.
All rights reserved. Privacy policy