Skip to main content

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.

excel-json-range-to-list.png

ArgumentTypeDescription
itemsrangeExcel range, contents of the cells will be joined into a list respecting their data type.
checkForNestedJsonInputboolean(Optional, default = true) When set to true valid JSON will not be escaped.
tip

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.

excel-get-list-item-by-position.png

ArgumentTypeDescription
jsonListtextA JSON-formatted list
positionnumberPosition of the item in the list that should be extracted.
tip

Negative numbers can be used in the position argument, this means the final item in the list can be accessed by entering '-1'

warning

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.

excel-keysvaluestojsonobject.png

ArgumentTypeDescription
keysrangeExcel range, contents of the cells will form the keys of the resulting object.
valuesrangeExcel range, contents of the cells will form the values of the resulting object.
checkForNestedJsonInputboolean(Optional, default = true) When set to true valid JSON will not be escaped.
tip

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.

excel-getjsonobjectvaluebykey.png

ArgumentTypeDescription
jsonObjecttextA JSON-formatted object.
keytextValue to be extracted identified by its key.