item

To extract a value of an array or an object

With this function, you can access a specific element in an array or JSON object based on a given index or key.

The index of the first element in an array is 0, the second element is 1, etc.

A key in a JSON object might be a string or a number.

Syntax

item([any], number)

item(JSON, number)

item(JSON, string)

Return

any

More about any >

Examples

item(myArray, choice) To extract a single item of an array, where the index is zero-based.

item(["Apple", "Cucumber" , "Orange"], 1)

Result: Cucumber

item(split("Ninox Software GmbH,Monbijouplatz 5,10178 Berlin", ","), 0) 

Result: Ninox Software GmbH with the comma (,) being the separator and 0 for the first entry. 1 would return Monbijouplatz 5.

item(myJSON, key) To extract the value of a key-value pair of a given JSON object. The key might be a string or a number.

let data := {
	firstName: "Steve",
	lastName: "Rogers"
	};
item(data, "firstName")

Result: Steve

See also

first, which returns the first item of an array.

last, which returns the last item of an array.

Last updated