Goto: 4C Home | 4C Docs | 4C External Libraries Home | FCJSon Home 4C FCJSon External Library - Overview

4C FCJSon External Library - Overview

15 January 2018

The FCJSon 4C external library is meant to allow applications to easily create and consume JSon content. The two main use cases for FCJSon are In order to effectively use the FCJSon library, you need to be familiar with the structure of a JSon object and the different data types that a json object can hold. The main JSon data structure is a JSon object and this structure can hold 0 or more member items. A member item is always a "<key> : <value>" pair. JSon object keys are enclosed in either single or double quotes. JSon object keys are case sensitive, so "Key1" and "key1" are not interchangeable. The data type of the <value> can be any of the following FCJSon uses an integer id to reference the objects in the JSon data structure. Most FCJSon functions expect an integer id as the first argument to the function. Every id that is returned by FCJSon must later be freed by the calling application using either FCJSon::Free() or FCJSon::FreeAll(). It is not possible to get an object that is deeper than 1 level from the object that it is being extracted from nor is it possible to put an object at a level deeper than 1 into an object. In order to do so, you have to first get the parent object id, possibly by making multiple calls into FCJSon to either get to the next level or to create the next level. Hopefully, the examples given later will make this clear.

For an application that is extracting data from a JSon object the normal flow of control will be as follows

For an application that is creating a JSon object to either store or send to another application the normal flow of control will be as follows When using the the FCJSon library you should be aware of the following

The FCJSon external library can set the following error codes Use sys.get_extfnopt(<libname>,"LastError") to get the error code set after making a call into the library that returns an error or warning.

Use sys.get_extfnopt(<libname>,"LastMessage") to get the error message set after making a call into the library that returns an error or warning.

Check sys_ret when a function returns an ambiguous value that could mean an error or could be a valid value. If the the function is returning an error, then sys_ret will be less than 0. If the function is returning a valid value with no warning then sys_ret will equal 0. if the function is returning a valid value and there is a warning, sys_ret will be > 0.

Credits and Acknowledgements

Back to Top