Skip to content

Examples

Arie J. Godschalk edited this page Nov 15, 2026 · 1 revision

Practical examples

Home › Examples

Contents

Build and read values

Follow the first example to build room and temperature. Both values come from the same Build JSON token; Read gives each its own correctly typed token. Select the smallest card with enough slots; larger cards can leave paths unused. To read more than ten values of one type, connect another Read card to the same JSON token.

Insert a whole array

  1. Add Build JSON (5 Json's). Leave Existing JSON empty.
  2. Enter readings in Property Path Json 1.
  3. Paste this into Json 1:
[18, 19, 21]
  1. Connect the JSON output to a Read card's Existing JSON. Enter readings[1] in Property Path Number 1.

Expected output: {"readings":[18,19,21]}, then Number 1 = 19. The JSON input is parsed, so the array is inserted as an array, not as a quoted piece of text. Use Text 1 instead if you intentionally want the characters to be stored as text. This does not append to an existing array; it replaces the specified property.

Read two list items

Given this input to Read JSON (3*3 arguments):

{
  "words": ["red", "blue"]
}

Set Property Path Text 1 to words[0] and Property Path Text 2 to words[1]. Text 1 is red and Text 2 is blue. Do not put both paths in one field. This adapts the developer's community answer.

Send one object to HomeyScript

Install HomeyScript and create a script. Connect Build's JSON output to the script card's argument input. For the first argument, a simple script is:

const data = JSON.parse(args[0]);
console.log(data.room);
return data.room;

With the first example, it logs and returns Kitchen. The argument is JSON text, so parse it once; do not paste untrusted text into executable code. Use the script card appropriate to your HomeyScript installation. The community discussion explains why passing one JSON object is useful.

Connect errors

In Advanced Flow, connect success from Build to Read and the error output to a notification or safe log. Do not feed a failed action's output to the next action. Check the first failing card and retry with a small known example. Avoid including private JSON in notifications or logs. For a list processed item by item, continue with Looping.

Clone this wiki locally