Functions¶
create and release¶
JSON_New¶
- group JSONXOP_New
register a new object
- param ignoreErr:
[optional, default 0] set to ignore runtime errors
- return:
a numeric identifier of the JSON object on success
Functions
-
variable JSON_New(variable ignoreErr = defaultValue)¶
JSON_Release¶
- group JSONXOP_Release
Release a JSON id from memory.
- param jsonID:
numeric identifier of the main object
- param ignoreErr:
[optional, default 0] set to ignore runtime errors
- return:
0 on success, NaN otherwise
Functions
-
variable JSON_Release(variable jsonID, variable ignoreErr = defaultValue)¶
parse and dump¶
JSON_Parse¶
- group JSONXOP_Parse
Parse a JSON string with the XOP.
- param jsonStr:
string representation of the JSON object
- param ignoreErr:
[optional, default 0] set to ignore runtime errors
- return:
a numeric identifier of the JSON object on success
Functions
-
variable JSON_Parse(string jsonStr, variable ignoreErr = defaultValue)¶
JSON_Dump¶
- group JSONXOP_Dump
Functions
-
string JSON_Dump(variable jsonID, variable indent = defaultValue, variable ignoreErr = defaultValue)¶
Dump a JSON id to its string representation.
- Parameters:
jsonID – numeric identifier of the main object
indent – [optional, default 0] number of white spaces for pretty output indentation.
ignoreErr – [optional, default 0] set to ignore runtime errors
- Returns:
a string representation of the JSON object
-
string JSON_Dump(variable jsonID, variable indent = defaultValue, variable ignoreErr = defaultValue)¶
structured types¶
JSON_AddTree¶
- group JSONXOP_AddTree
Functions
-
variable JSON_AddTreeObject(variable jsonID, string jsonPath, variable ignoreErr = defaultValue)¶
Recursively add new objects to the tree.
Non-existing path elements are recursively created.
See also
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
ignoreErr – [optional, default 0] set to ignore runtime errors
- Returns:
0 on success
-
variable JSON_AddTreeArray(variable jsonID, string jsonPath, variable ignoreErr = defaultValue)¶
Recursively add a new array to the tree.
Non-existing path elements are created as objects.
See also
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable static JSON_AddTree(variable jsonID, string jsonPath, variable type, variable ignoreErr)¶
-
variable JSON_AddTreeObject(variable jsonID, string jsonPath, variable ignoreErr = defaultValue)¶
JSON_AddValue¶
- group JSONXOP_AddValue
Functions
-
variable JSON_AddString(variable jsonID, string jsonPath, string value, variable ignoreErr = defaultValue)¶
Add a string entity to a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
value – string value to add
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable JSON_AddVariable(variable jsonID, string jsonPath, variable value, variable significance = defaultValue, variable ignoreErr = defaultValue)¶
Add a numeric entity to a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
value – numeric value to add
significance – [optional] number of digits after the decimal sign
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable JSON_AddNull(variable jsonID, string jsonPath, variable ignoreErr = defaultValue)¶
Add a
null
entity to a JSON object.- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable JSON_AddBoolean(variable jsonID, string jsonPath, variable value, variable ignoreErr = defaultValue)¶
Add a numeric value as boolean to a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
value – boolean value to add
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable JSON_AddWave(variable jsonID, string jsonPath, wave wv, variable ignoreErr = defaultValue)¶
Add a WAVE as array entity to a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
wv – WAVE reference to the wave to add
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable JSON_AddInt64(variable jsonID, string jsonPath, int64 value, variable ignoreErr = defaultValue)¶
Add a 64bit integer to a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
value – int64 value to add
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable JSON_AddUInt64(variable jsonID, string jsonPath, uint64 value, variable ignoreErr = defaultValue)¶
Add an unsigned 64bit integer to a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
value – uint64 value to add
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable static AddValueI64(variable jsonID, string jsonPath, wave w, variable ignoreErr)¶
-
variable JSON_AddObjects(variable jsonID, string jsonPath, variable objCount = defaultValue, variable ignoreErr = defaultValue)¶
Add a specified number of objects to a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
objCount – [optional, default 1] number of objects
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable JSON_AddJSON(variable jsonID, string jsonPath, variable jsonID2, variable ignoreErr = defaultValue)¶
Merge a JSON object to another object.
- Parameters:
jsonID – numeric identifier of the main object
jsonPath – RFC 6901 compliant JSON Pointer
jsonID2 – numeric identifier of the merged object, the merged JSON object is NOT freed by JSON_AddJSON. The caller keeps ownership of it.
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable JSON_SetString(variable jsonID, string jsonPath, string value, variable ignoreErr = defaultValue)¶
Replace with a string entity at the given location in a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
value – new string value
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable JSON_SetVariable(variable jsonID, string jsonPath, variable value, variable significance = defaultValue, variable ignoreErr = defaultValue)¶
Replace with a numeric entity at the given location in a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
value – new numeric value
significance – [optional] number of digits after the decimal sign
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable JSON_SetNull(variable jsonID, string jsonPath, variable ignoreErr = defaultValue)¶
Replace with a
null
entity at the given location in a JSON object.- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable JSON_SetBoolean(variable jsonID, string jsonPath, variable value, variable ignoreErr = defaultValue)¶
Replace with a boolean value at the given location in a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
value – new boolean value
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable JSON_SetWave(variable jsonID, string jsonPath, wave wv, variable ignoreErr = defaultValue)¶
Replace with a WAVE as array entity at the given location in a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
wv – WAVE reference to the new wave
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable JSON_SetInt64(variable jsonID, string jsonPath, int64 value, variable ignoreErr = defaultValue)¶
Replace with a 64bit integer at the given location in a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
value – new int64 value
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable JSON_SetUInt64(variable jsonID, string jsonPath, uint64 value, variable ignoreErr = defaultValue)¶
Replace with an unsigned 64bit integer at the given location in a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
value – new uint64 value
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable static SetValueI64(variable jsonID, string jsonPath, wave w, variable ignoreErr)¶
-
variable JSON_SetObjects(variable jsonID, string jsonPath, variable objCount = defaultValue, variable ignoreErr = defaultValue)¶
Replace with a specified number of objects at the giveln location in a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
objCount – [optional, default 1] number of objects
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable JSON_SetJSON(variable jsonID, string jsonPath, variable jsonID2, variable ignoreErr = defaultValue)¶
Replace an entity with the given JSON object at the specified location in the main object.
- Parameters:
jsonID – numeric identifier of the main object
jsonPath – RFC 6901 compliant JSON Pointer
jsonID2 – numeric identifier of the merged object
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable JSON_AddString(variable jsonID, string jsonPath, string value, variable ignoreErr = defaultValue)¶
JSON_GetValue¶
- group JSONXOP_GetValue
Functions
-
variable JSON_GetJSON(variable jsonID, string jsonPath, variable ignoreErr = defaultValue)¶
Get new JSON object from a json path of an existing JSON object. The original jsonID is not freed and stays valid. The new jsonID contains a copy of the JSON object referenced by jsonpath in the existing jsonID.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
ignoreErr – [optional, default 0] set to ignore runtime errors
- Returns:
a new jsonID containing a copy of the JSON object referenced by jsonpath in jsonID
-
string JSON_GetString(variable jsonID, string jsonPath, variable ignoreErr = defaultValue)¶
Get a text entity as string variable from a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
ignoreErr – [optional, default 0] set to ignore runtime errors
- Returns:
a string containing the entity
-
variable JSON_GetVariable(variable jsonID, string jsonPath, variable ignoreErr = defaultValue)¶
Get a numeric, boolean or null entity as variable from a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
ignoreErr – [optional, default 0] set to ignore runtime errors
- Returns:
a numeric variable containing the entity
-
wave JSON_GetTextWave(variable jsonID, string jsonPath, variable ignoreErr = defaultValue)¶
Get an array as text wave from a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
ignoreErr – [optional, default 0] set to ignore runtime errors
- Returns:
a free text wave with the elements of the array
-
wave JSON_GetWave(variable jsonID, string jsonPath, variable ignoreErr = defaultValue, variable waveMode = defaultValue)¶
Get an array as numeric wave from a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
ignoreErr – [optional, default 0] set to ignore runtime errors
waveMode – [optional, default 0] when set and an element from the JSON could not be converted to a number a null wave is returned. When not set (default) NaN is set for that element in the wave. This allows to retrieve convertible elements after the element that could not be converted to a number.
- Returns:
a free numeric double precision wave with the elements of the array
-
std::tuple<int64> JSON_GetInt64(variable jsonID, string jsonPath, variable ignoreErr = defaultValue)¶
Get a 64bit integer from a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
ignoreErr – [optional, default 0] set to ignore runtime errors
- Returns:
a 64bit variable
-
std::tuple<uint64> JSON_GetUInt64(variable jsonID, string jsonPath, variable ignoreErr = defaultValue)¶
Get an unsigned 64bit integer from a JSON object.
- Parameters:
jsonID – numeric identifier of the JSON object
jsonPath – RFC 6901 compliant JSON Pointer
ignoreErr – [optional, default 0] set to ignore runtime errors
- Returns:
an unsigned 64bit variable
-
variable JSON_GetJSON(variable jsonID, string jsonPath, variable ignoreErr = defaultValue)¶
JSON_GetType¶
- group JSONXOP_GetType
get the JSON Type for an element at the given path.
See also
- param jsonID:
numeric identifier of the JSON object
- param jsonPath:
RFC 6901 compliant JSON Pointer
- param ignoreErr:
[optional, default 0] set to ignore runtime errors
- return:
a numeric value representing one of the defined
Functions
-
variable JSON_GetType(variable jsonID, string jsonPath, variable ignoreErr = defaultValue)¶
JSON_GetKeys¶
- group JSONXOP_GetKeys
Get the name of all object members of the specified path.
- param jsonID:
numeric identifier of the JSON object
- param jsonPath:
RFC 6901 compliant JSON Pointer
- param ignoreErr:
[optional, default 0] set to ignore runtime errors
- param esc:
[optional, 0 or 1] set to ignore RFC 6901 path escaping standards
- return:
a free text wave with all elements as rows.
Functions
-
wave JSON_GetKeys(variable jsonID, string jsonPath, variable esc = defaultValue, variable ignoreErr = defaultValue)¶
JSON_Exists¶
- group JSONXOP_Exists
Functions
-
variable JSON_Exists(variable jsonID, string jsonPath)¶
Check if the jsonID/jsonPath is valid.
- Parameters:
jsonID – numeric identifier of the main object
jsonPath – RFC 6901 compliant JSON Pointer
- Returns:
1 if object at jsonPath exists in JSON object, 0 otherwise
-
variable JSON_Exists(variable jsonID, string jsonPath)¶
JSON_Remove¶
- group JSONXOP_Remove
Remove a path element from a JSON string representation.
- param jsonID:
numeric identifier of the main object
- param jsonPath:
RFC 6901 compliant JSON Pointer
- param ignoreErr:
[optional, default 0] set to ignore runtime errors
- return:
0 on success, NaN otherwise
Functions
-
variable JSON_Remove(variable jsonID, string jsonPath, variable ignoreErr = defaultValue)¶
arrays¶
JSON_GetArraySize¶
- group JSONXOP_GetArraySize
Get the number of elements in an array.
- param jsonID:
numeric identifier of the JSON object
- param jsonPath:
RFC 6901 compliant JSON Pointer
- param ignoreErr:
[optional, default 0] set to ignore runtime errors
- return:
a numeric variable with the number of elements the array at jsonPath
Functions
-
variable JSON_GetArraySize(variable jsonID, string jsonPath, variable ignoreErr = defaultValue)¶
JSON_GetMaxArraySize¶
- group JSONXOP_GetMaxArraySize
Get the maximum element size for each dimension in an array.
- param jsonID:
numeric identifier of the JSON object
- param jsonPath:
RFC 6901 compliant JSON Pointer
- param ignoreErr:
[optional, default 0] set to ignore runtime errors
- return:
a free numeric wave with the size for each dimension as rows
Functions
-
wave JSON_GetMaxArraySize(variable jsonID, string jsonPath, variable ignoreErr = defaultValue)¶
version information¶
JSON_Version¶
- group JSONXOP_Version
Functions
-
string JSON_Version(variable ignoreErr = defaultValue)¶
Output version information useful for issue reports.
- Parameters:
ignoreErr – [optional, default 0] set to ignore runtime errors
-
string JSON_Version(variable ignoreErr = defaultValue)¶
JSON_GetIgorInfo¶
- group JSON_GetIgorInfo
Functions
-
variable JSON_GetIgorInfo(variable ignoreErr = defaultValue)¶
Return JSON with Igor information.
- Parameters:
ignoreErr – [optional, default 0] set to ignore runtime errors
-
variable JSON_GetIgorInfo(variable ignoreErr = defaultValue)¶
Options¶
JSON_Options¶
- group JSONXOP_Options
Functions
-
variable JSON_DisableQuietMode()¶
Disables quiet mode.
-
variable JSON_EnableQuietMode()¶
Enables quiet mode.
-
variable JSON_SetIgnoreErrors()¶
Sets the ignore errors define for the json wrapper functions.
-
variable JSON_UnsetIgnoreErrors()¶
Undefines the ignore errors define for the json wrapper functions.
-
variable JSON_DisableQuietMode()¶
Synchronisation¶
JSON_SyncJSON¶
- group JSON_SyncJSON
Functions
-
variable JSON_SyncJSON(variable srcJsonId, variable tgtJsonId, string srcPath, string tgtPath, variable syncOptions, variable ignoreErr = defaultValue)¶
Syncs data from a source json into a target json.
See also
- Parameters:
srcJsonId – [in] json Id of source object
tgtJsonId – [in] json Id of target object
srcPath – [in] root path for sync in source
tgtPath – [in] root path for sync in target
syncOptions – [in] defines how source-target differences are handled by the synchronisation
ignoreErr – [in] [optional, default 0] set to ignore runtime errors
-
variable JSON_SyncJSON(variable srcJsonId, variable tgtJsonId, string srcPath, string tgtPath, variable syncOptions, variable ignoreErr = defaultValue)¶
JSON_Load and JSON_Save¶
- group JSON_LoadSave
Functions
-
variable JSON_Load(string fullFilepath, variable ignoreErr = defaultValue)¶
Loads a text file and parses it to JSON, then returns jsonId.
- Parameters:
fullFilepath – [in] full file path of the text file
ignoreErr – [in] [optional, default 0] set to ignore runtime errors
- Returns:
jsonId of the parsed text data or NaN if unsuccessful
-
variable JSON_Save(variable jsonId, string fullFilepath, variable ignoreErr = defaultValue)¶
Saves a JSON to a text file. If the target file exists it is overwritten.
- Parameters:
jsonId – [in] jsonId of the json data to save
fullFilepath – [in] full file path of a file to be written
ignoreErr – [in] [optional, default 0] set to ignore runtime errors
- Returns:
0 if the save was successful or NaN if there was an error
-
variable JSON_Load(string fullFilepath, variable ignoreErr = defaultValue)¶
JSON_IsValid¶
- group JSON_IsValid
Functions
-
variable JSON_IsValid(variable jsonID)¶
Check if the given JSON identifier refers to an open JSON document.
- Parameters:
jsonID – numeric identifier of the main object
- Returns:
0 if the JSON identifier refers to an open JSON document, 1 otherwise
-
variable JSON_IsValid(variable jsonID)¶