JSON_ARR   (RPGLE)

JSON Array Implementation
More ....

Procedures  [top]

jsona_clear exported
Clear array
jsona_create exported
Create JSON array
jsona_dispose exported
Dispose JSON array
jsona_getArray exported
Get array entry
jsona_getBoolean exported
Get boolean entry
jsona_getDouble exported
Get double entry
jsona_getInt exported
Get integer entry
jsona_getLong exported
Get long entry
jsona_getObject exported
Get object entry
jsona_getString exported
Get string entry
jsona_putArray exported
Add array entry
jsona_putBoolean exported
Add boolean entry
jsona_putDouble exported
Add double entry
jsona_putInt exported
Add integer entry
jsona_putLong exported
Add long entry
jsona_putNull exported
Add null value entry
jsona_putObject exported
Add JSON object entry
jsona_putString exported
Add character entry
jsona_remove exported
Remove an entry from the array
jsona_size exported
Get array size
jsona_toString exported
String representation of the JSON array in JSON syntax

Copybooks  [top]

JSON_H
JSON_INT_H
LLIST_H
CEEAPI_H
JSON_C

Detailed Description  [top]

The value of a JSON object can be an array. This service program deals with such arrays. Arrays themselves can also contain arrays. An array can only contain values and arrays but no key/value pairs.

Throughout this service program is the index always 0-based. Which means that the first entry has the index 0, the second entry has the index 1 and so on.

If the index is out of the bounds of the array an escape message will be send. If a procedure for the retrieval of a special type of value is called on an entry of another type an escape message will be send too.
Author:
Mihael Schmidt
Date:
19.04.2008
Links:
JSON
Changes:
07.03.2009   —   Mihael Schmidt
Added jsona_size procedure.



Procedure Documentation  [top]

jsona_clear  [top]

jsona_clear ( Pointer )
Removes all elements from the array.
Parameters:
Pointer Pointer to the JSON array
Exported.

jsona_create  [top]

Pointer jsona_create ( )
Creates a json array "object". Currently a linked list is used as a backend for the json array.
Return value:
Pointer Pointer to the JSON array
Exported.
Author:
Mihael Schmidt
Date:
19.04.2008

jsona_dispose  [top]

jsona_dispose ( Pointer )
Disposes a JSON array and all values it contains. All added arrays are also disposed.
Parameters:
Pointer Pointer to the JSON array
Exported.
Author:
Mihael Schmidt
Date:
19.04.2008

jsona_getArray  [top]

Pointer jsona_getArray ( Pointer, Unsigned )
Returns the array value of the entry.

If the entry is not of type array an escape message will be send.
Parameters:
Pointer Pointer to the JSON array
Numeric (Unsigned) (10) Index
Return value:
Pointer Pointer to the JSON array
Exported.
Author:
Mihael Schmidt
Date:
20.03.2008

jsona_getBoolean  [top]

Boolean jsona_getBoolean ( Pointer, Unsigned )
Returns the boolean value of the entry.

If the entry is not of type boolean an escape message will be send.
Parameters:
Pointer Pointer to the JSON array
Numeric (Unsigned) (10) Index
Return value:
Boolean Boolean value of the entry
Exported.
Author:
Mihael Schmidt
Date:
20.03.2008

jsona_getDouble  [top]

Float jsona_getDouble ( Pointer, Unsigned )
Returns the double value of the entry.

If the entry is not of type double an escape message will be send.
Parameters:
Pointer Pointer to the JSON array
Numeric (Unsigned) (10) Index
Return value:
Numeric (Float) (8,) Double value of the entry
Exported.
Author:
Mihael Schmidt
Date:
20.03.2008

jsona_getInt  [top]

Integer jsona_getInt ( Pointer, Unsigned )
Returns the integer value of the entry.

If the entry is not of type integer an escape message will be send.
Parameters:
Pointer Pointer to the JSON array
Numeric (Unsigned) (10) Index
Return value:
Numeric (Integer) (10) Integer value of the entry
Exported.
Author:
Mihael Schmidt
Date:
20.03.2008

jsona_getLong  [top]

Integer jsona_getLong ( Pointer, Unsigned )
Returns the long value of the entry.

If the entry is not of type long an escape message will be send.
Parameters:
Pointer Pointer to the JSON array
Numeric (Unsigned) (10) Index
Return value:
Numeric (Integer) (20) Long value of the entry
Exported.
Author:
Mihael Schmidt
Date:
20.03.2008

jsona_getObject  [top]

Pointer jsona_getObject ( Pointer, Unsigned )
Returns a pointer to the object.

If the entry is not of type object an escape message will be send.
Parameters:
Pointer Pointer to the JSON array
Numeric (Unsigned) (10) Index
Return value:
Pointer Pointer to the JSON object
Exported.
Author:
Mihael Schmidt
Date:
11.05.2008

jsona_getString  [top]

Pointer jsona_getString ( Pointer, Unsigned )
Returns a pointer to the value of the entry for the passed key. The value is null terminated and can be processed with the %str BIF.

If the entry is not of type string an escape message will be send.
Parameters:
Pointer Pointer to the JSON array
Numeric (Unsigned) (10) Index
Return value:
Pointer Pointer to a null-terminated string
Exported.
Author:
Mihael Schmidt
Date:
20.03.2008

jsona_putArray  [top]

jsona_putArray ( Pointer, Pointer, Unsigned )
Adds an entry of type array.
Parameters:
Pointer Pointer to the JSON array
Pointer Array
Numeric (Unsigned) (10) Index (default: last)
Exported.
Author:
Mihael Schmidt
Date:
19.04.2008

jsona_putBoolean  [top]

jsona_putBoolean ( Pointer, Boolean, Unsigned )
Adds an entry of type boolean.
Parameters:
Pointer Pointer to the JSON array
Boolean Value
Numeric (Unsigned) (10) Index (default: last)
Exported.
Author:
Mihael Schmidt
Date:
20.03.2008

jsona_putDouble  [top]

jsona_putDouble ( Pointer, Float, Unsigned )
Adds an entry of type double.
Parameters:
Pointer Pointer to the JSON array
Numeric (Float) (8,) Value
Numeric (Unsigned) (10) Index (default: last)
Exported.
Author:
Mihael Schmidt
Date:
20.03.2008

jsona_putInt  [top]

jsona_putInt ( Pointer, Integer, Unsigned )
Adds an entry of type integer.
Parameters:
Pointer Pointer to the JSON array
Numeric (Integer) (10) Value
Numeric (Unsigned) (10) Index (default: last)
Exported.
Author:
Mihael Schmidt
Date:
20.03.2008

jsona_putLong  [top]

jsona_putLong ( Pointer, Integer, Unsigned )
Adds an entry of type long.
Parameters:
Pointer Pointer to the JSON array
Numeric (Integer) (20) Value
Numeric (Unsigned) (10) Index (default: last)
Exported.
Author:
Mihael Schmidt
Date:
20.03.2008

jsona_putNull  [top]

jsona_putNull ( Pointer, Unsigned )
Adds an entry of type null to the array.
Parameters:
Pointer Pointer to the JSON array
Numeric (Unsigned) (10) Index (default: last)
Exported.
Author:
Mihael Schmidt
Date:
11.05.2008

jsona_putObject  [top]

jsona_putObject ( Pointer, Pointer, Unsigned )
Adds an entry of type object to the array.
Parameters:
Pointer Pointer to the JSON array
Pointer Pointer to the JSON object
Numeric (Unsigned) (10) Index (default: last)
Exported.
Author:
Mihael Schmidt
Date:
11.05.2008

jsona_putString  [top]

jsona_putString ( Pointer, Character, Unsigned )
Adds an entry of type character.
Parameters:
Pointer Pointer to the JSON array
Character (65535) Value
Numeric (Unsigned) (10) Index (default: last)
Exported.
Author:
Mihael Schmidt
Date:
20.03.2008

jsona_remove  [top]

jsona_remove ( Pointer, Integer )
Parameters:
Pointer Pointer to the JSON array
Numeric (Integer) (10) Index of the element to be removed (0-based)
Exported.

jsona_size  [top]

Unsigned jsona_size ( Pointer )
Returns the number of elements in the array.
Parameters:
Pointer Pointer to the json array
Return value:
Numeric (Unsigned) (10) number of elements
Exported.

jsona_toString  [top]

Pointer jsona_toString ( Pointer )
Creates a null terminated string representation of the JSON array in JSON syntax.

For entries of type string double quotes and backslashes will be escaped (" => \" and \ => \\).
Parameters:
Pointer Pointer to the JSON array
Exported.
Author:
Mihael Schmidt
Date:
20.03.2008