Re: FXJSON

Jeroen van der Zijp <[email protected]>
Newsgroups gmane.comp.lib.fox-toolkit.user
Organization FOX Toolkit
Message-ID <[email protected]>
On Sat, 30 Oct 2021 18:07:06 -0400
"John Selverian" <[email protected]> wrote:

>Any examples for using FXJSON? I'm trying to read an xml file then parse it.


For XML, we have the FXXML parser; the FXJSON parser parses JSON files;
the language spec we support is JSON5 (https://json5.org/), but plain 
JSON of course is fully accepted (https://www.json.org/json-en.html).

FXJSON parses a json file and builds a tree of FXVariant nodes containing
the parsed items.

If your project needs some sort of configuration, and the registry format
is too simple, json may be for you.  Its more human-friendly than XML;
JSON5 extends the stock JSON with optional enquoting of keys, allows for
c- and c++-style comments, and a few other minor wrinkles.

If its XML you need be aware that FXXML issues callbacks for the structures
found in the XML file, and therefore you need to build a DOM structure yourself
by intercepting these callbacks.

Needless to say, all my apps that need complex configuration are using FXJSON
and FXVariant for inputs.

The example program "variant" reads and writes FXVariants from/to FXJSON file.

Note, we can read JSON5 but when writing its strict JSON [we may add an option
for JSON5 output in the future; so far no one has asked for it].


	Cheers,

		--- JVZ





-- 
+----------------------------------------------------------------------------+
| Copyright (C) 17:40 10/30/2021 Jeroen van der Zijp.   All Rights Reserved. |
+----------------------------------------------------------------------------+
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.