Skip to main content

Data Types \ Json \ JsonArray

A JSON array is an ordered list of items — for example ["apple", "cherry", "banana"]. The nodes on this page let you build arrays, add to them, read items back out, inspect them, and turn them into plain text you can store, send, or print.

What's on this page

  • Create — start a brand-new array, either empty or from a piece of text.
  • Add a value — append an item to the end of an existing array (one node per item type).
  • Read an element — pull an item back out by its position (one node per item type).
  • Inspect — find out the size, the valid positions, or the type of an item.
  • Convert — turn the whole array into a single piece of text.

About indexes: positions in a JSON array start at 1, not 0. The first item is at index 1, the second at index 2, and so on.


Create

Response_JsonArray_Create.png Create Json Array

Makes a fresh, empty JSON array. Use this as the starting point when you want to build a list from scratch.

What it does

This node produces a brand-new JSON array with nothing in it: []. From there you'd typically wire it into one or more Add Json Array Value nodes to fill it with items.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output. The node only runs when triggered.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes. Wire it into whatever should run next.
JsonArray JSON array A new, empty array [].

Tips

  • Chain it. Wire this node's JsonArray output into the JsonArray input of an Add Json Array Value node to put the first item in.
  • Or start from text. If you already have your data as a string like [1, 2, 3], use Create Json Array From String instead.

Response_JsonArray_Create_FromString.png Create Json Array From String

Reads a piece of text written in JSON array form and turns it into a real JSON array you can work with.

What it does

Useful when the data arrived as text — for example from a file you read, a message someone sent, or a value pasted into a configuration. The node parses the text and gives you back a proper JSON array that the other JSON nodes can use.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output.
String Text The text to parse. It must look like a JSON array — that is, start with [ and end with ], with items separated by commas.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes.
String Text The same text you passed in (in case the next node needs it as well).
JsonArray JSON array The parsed array.

Example

String input [1, 2, 3]
JsonArray output [1, 2, 3] — now a real JSON array

Tips

  • Match the format. If the text is malformed (a missing bracket, an extra comma, etc.) the node won't be able to parse it.
  • Reverse direction. To go the other way and turn an array into text, see Json Array To String further down this page.

Add a value

These five nodes all do the same thing — add a value to the end of a JSON array — but each one accepts a different kind of value. Pick the one that matches what you're adding.

None of them modify the original array. What comes out is a new array with the extra item on the end.

Add Json Array Value (String)

Adds a piece of text to the end of a JSON array.

What it does

This node takes a JSON array and a piece of text, and gives you back a new array with the text added on the end.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output.
JsonArray JSON array The list you want to add to. Often comes from a Create Json Array node or from a previous step.
Value Text The piece of text you want to append.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes.
JsonArray JSON array The updated array with your text added at the end.
Value Text The same text you passed in.

Example

JsonArray input ["apple", "cherry"]
Value input "banana"
JsonArray output ["apple", "cherry", "banana"]

Add Json Array Value (Number)

Adds a number to the end of a JSON array.

What it does

Same as the text version, but for numbers. Works with whole numbers and decimals; positive or negative.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output.
JsonArray JSON array The list you want to add to.
Value Number The number you want to append.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes.
JsonArray JSON array The updated array with your number added at the end.
Value Number The same number you passed in.

Example

JsonArray input [20, -5]
Value input 3
JsonArray output [20, -5, 3]

Add Json Array Value (Boolean)

Adds a true/false value to the end of a JSON array.

What it does

Same idea as the other Add variants, but the value being appended is a true/false.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output.
JsonArray JSON array The list you want to add to.
Value Boolean (true/false) The value you want to append.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes.
JsonArray JSON array The updated array with the true/false added at the end.
Value Boolean The same value you passed in.

Example

JsonArray input [true, false]
Value input true
JsonArray output [true, false, true]

Add Json Array Value (JsonObject)

Adds a JSON object to the end of a JSON array.

What it does

Useful for building a list of records — for example a list of scores, settings, or scene items, where each entry has several named fields.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output.
JsonArray JSON array The list you want to add to.
Value JSON object The object you want to append. See the JSON Objects page for nodes that build one.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes.
JsonArray JSON array The updated array with the object added at the end.
Value JSON object The same object you passed in.

Example

JsonArray input [{"score": 10}]
Value input {"score": 8}
JsonArray output [{"score": 10}, {"score": 8}]

Add Json Array Value (JsonArray)

Adds another JSON array as a single entry — producing a nested list.

What it does

The inner array is added as one item. The outer array's size grows by one regardless of how many items are inside the array you're adding. This is how you build grids, rows-of-rows, or any nested structure.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output.
JsonArray JSON array The outer list you want to add to.
Value JSON array The array to add as one entry inside the outer one.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes.
JsonArray JSON array The updated outer array with the inner array added at the end.
Value JSON array The same inner array you passed in.

Example

JsonArray input [[7, 4]]
Value input [9, 2]
JsonArray output [[7, 4], [9, 2]]

Read an element

These five nodes all pull a single item back out of a JSON array. You pick the item by its position (its Index). Each variant returns the value as a specific type — pick the one that matches what you stored.

The array isn't modified — the value is read out, the array stays the same.

Get Json Array Element (String)

Reads one item from a JSON array as text.

What it does

Returns the item at the position you specify. Use this when the item at that position is a piece of text.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output.
JsonArray JSON array The array to read from. Must not be empty.
Index Integer Which position to read. The first item is at 1.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes.
JsonArray JSON array The same array you passed in.
Index Integer The same position you asked for.
Value Text The item at that position.

Example

JsonArray input ["apple", "banana", "cherry", "avocado"]
Index input 3
Value output "cherry"

Get Json Array Element (Number)

Reads one item from a JSON array as a number.

What it does

Returns the item at the position you specify. Use this when the item at that position is a number.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output.
JsonArray JSON array The array to read from. Must not be empty.
Index Integer Which position to read. Starts at 1.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes.
JsonArray JSON array The same array you passed in.
Index Integer The same position you asked for.
Value Number The number at that position.

Example

JsonArray input [12, 47, 88, 103, 256, 411]
Index input 5
Value output 256

Get Json Array Element (Boolean)

Reads one item from a JSON array as a true/false value.

What it does

Returns the item at the position you specify. Use this when the item at that position is a true/false value.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output.
JsonArray JSON array The array to read from. Must not be empty.
Index Integer Which position to read. Starts at 1.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes.
JsonArray JSON array The same array you passed in.
Index Integer The same position you asked for.
Value Boolean The true/false value at that position.

Example

JsonArray input [true, false, true, true, false, false, true]
Index input 6
Value output false

Get Json Array Element (JsonObject)

Reads one item from a JSON array as a JSON object.

What it does

Returns the item at the position you specify. Use this when each item in the array is a JSON object (a record with named fields). Once you have the object, the nodes on the JSON Objects page can read individual fields.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output.
JsonArray JSON array The array to read from. Must not be empty.
Index Integer Which position to read. Starts at 1.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes.
JsonArray JSON array The same array you passed in.
Index Integer The same position you asked for.
Value JSON object The object at that position.

Example

JsonArray input [{"id": 101}, {"id": 102}, {"id": 103}, {"id": 104}, {"id": 105}]
Index input 4
Value output {"id": 104}

Get Json Array Element (JsonArray)

Reads one item from a JSON array as another JSON array (a nested array).

What it does

Returns the item at the position you specify. Use this when each item in the outer array is itself an array — for example a grid or a list of points.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output.
JsonArray JSON array The outer array to read from. Must not be empty.
Index Integer Which position to read. Starts at 1.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes.
JsonArray JSON array The same outer array you passed in.
Index Integer The same position you asked for.
Value JSON array The inner array at that position.

Example

JsonArray input [[10, 20], [30, 40], [50, 60], [70, 80], [90, 100]]
Index input 4
Value output [70, 80]

Inspect

These three nodes don't read items out of the array — they tell you about it. Use them when you need to know how big the array is, what positions are valid, or what kind of item is at a given position.

Response_JsonArray_Size_Get.png Get Json Array Size

Tells you how many items are in the array.

What it does

Returns the total number of items as a number. An empty array returns 0.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output.
JsonArray JSON array The array to measure.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes.
JsonArray JSON array The same array you passed in.
Size Number How many items the array contains.

Example

JsonArray input ["red", "green", "blue"]
Size output 3

Response_JsonArray_Indices_Get.png Get Json Array Indices

Gives you the list of valid positions in the array.

What it does

Returns each valid index in the array, one after another — 1, 2, 3, … up to the array's size. Handy when you want to step through every item using a loop construct or for-each pattern.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output.
JsonArray JSON array The array whose positions you want.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes.
JsonArray JSON array The same array you passed in.
Indices Integer Each valid position in turn (1, then 2, then 3, …).

Example

JsonArray input ["red", "green", "blue"]
Indices output 1, 2, 3

Tips

  • Use with Get. Pair this with one of the Get Json Array Element nodes to read every item in turn.
  • Empty arrays. If the array is empty, no indices are produced.

Response_JsonArray_Type_Get.png Get Json Array Element Type

Tells you what kind of item is stored at a given position.

What it does

Returns the type of the item at the position you specify, as a short piece of text: "String", "Number", "Boolean", "JsonObject", or "JsonArray". Use this when an array can hold different kinds of items and you need to decide which Get node to use.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output.
JsonArray JSON array The array containing the item. Must not be empty.
Index Integer Which position to check. Starts at 1.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes.
JsonArray JSON array The same array you passed in.
Index Integer The same position you asked for.
Type Text The type of the item at that position, as a short name.

Example

JsonArray input [3.14, 2.71, 1.41, 1.62, 0.57, 6.28]
Index input 5
Type output "Number"

Convert

Response_JsonArray_ToString.png Json Array To String

Turns the entire array into a single piece of text.

What it does

Produces a text representation of the whole array, written in JSON form. Useful when you need to save the array to a file, send it to another system, or put it somewhere that only accepts text.

The original array isn't modified — you get the same array back plus a text version.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node's Execute output.
JsonArray JSON array The array to convert.

Outputs

Port Type What you get
Execute Trigger Fires after this node finishes.
JsonArray JSON array The same array you passed in.
Result Text The text version of the array.

Example

JsonArray input ["red", "green", "blue"]
Result output '["red", "green", "blue"]'

Tips

  • Reverse direction. To go back from text to an array, use Create Json Array From String at the top of this page.

  • JSON Objects — the matching page for working with records that have named fields.