Skip to main content


Topic: Advice for writing/porting a JSON parser to C++ using nall? (Read 2906 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Advice for writing/porting a JSON parser to C++ using nall?
I'm a huge fan of byuu's nall library (latest version is in the latest higan release). It has made my C++ programming exponentially simpler and has proven to be significantly lighter weight in my programs than std equivalents. In its very robust string parsing capabilities is code for parsing text as markup, specifically XML and byuu's own BML. It's missing a JSON parser, however, and I wanted to write or port one for byuu to add to nall proper.

I've been having a devil of a time getting myself organized about it :(  Initially I started by porting SuperEasyJSON to nall syntax but I kept getting error after error. Then I decided to start over and attempt to replicate the API found in nall's existing parsers (found in the nall/string/markup directory) but the inconsistency between how XML is parsed and how BML is parsed results in me unable to choose one or the other to use as a jumping off point.

How should I go about writing a JSON parser for nall? Every instinct I have says "parse one character at a time" but I would love to take advantage of nall's existing functionality, especially with regards to node iteration and value conversion, and Unicode inside JSON strings is supported and that would be annoying to handle alone even with this unicode_to_utf8 function.
  • Last Edit: December 29, 2013, 04:23:03 am by N E O