JSON
The below documentation showcases how to use all of the additional Excel functions that are provided by the ArupCompute Excel plugin for working with JSON.
RangeToJsonList
The =ArupCompute.JSON.RangeToJsonList(...
function takes an Excel range and joins the contents together to form a JSON list.
Argument | Type | Description |
---|---|---|
items | range | Excel range, contents of the cells will be joined into a list respecting their data type. |
checkForNestedJsonInput | boolean | (Optional, default = true) When set to true valid JSON will not be escaped. |
The checkForNestedJsonInput
toggle allows two modes of operation:
- True - allows complex nested JSON objects to be created
- False - allows JSON to be sent as an escaped string - useful when the end function wants to unpack the JSON itself rather than relying on ArupCompute
Check with the target library developer what the expected approach is.
GetListItemByPosition
The =ArupCompute.JSON.GetListItemByPosition(...
function takes a JSON list and extracts a value from it.
Argument | Type | Description |
---|---|---|
jsonList | text | A JSON-formatted list |
position | number | Position of the item in the list that should be extracted. |
Negative numbers can be used in the position argument, this means the final item in the list can be accessed by entering '-1'
The position argument is zero-indexed this means to get the first item you must enter '0'
KeysValuesToJsonObject
The =ArupCompute.JSON.KeysValuesToJsonObject(...
function takes a list of keys and values and pairs them up to create a JSON formatted object.
Argument | Type | Description |
---|---|---|
keys | range | Excel range, contents of the cells will form the keys of the resulting object. |
values | range | Excel range, contents of the cells will form the values of the resulting object. |
checkForNestedJsonInput | boolean | (Optional, default = true) When set to true valid JSON will not be escaped. |
The checkForNestedJsonInput
toggle allows two modes of operation:
- True - allows complex nested JSON objects to be created
- False - allows JSON to be sent as an escaped string - useful when the end function wants to unpack the JSON itself rather than relying on ArupCompute
Check with the target library developer what the expected approach is.
GetJsonObjectValueByKey
The =ArupCompute.JSON.GetJsonObjectValueByKey(...
function extracts a value from a JSON object based on the provided key.
Argument | Type | Description |
---|---|---|
jsonObject | text | A JSON-formatted object. |
key | text | Value to be extracted identified by its key. |