Merge

Combine up to eight inputs into one JSON object keyed by port, when any or all have arrived.

  • Data
  • Since 0.2.0
  • merge
  • combine
  • join
  • object
  • json
  • data

Open in TuneToys

Merge as the Patch draws it, at default values: inlets on the left, outlets on the right.

Merge gathers up to eight data values into one JSON object, { "a": …, "b": … }, keyed by the input each value arrived on.

What it does#

Each input a to h keeps its newest value. When Merge emits, value carries an object with one key per cabled input that has a value, and trigger fires once. A data input takes one cable, so Merge is also how several sources meet in one place.

When to use it#

Use it to build a JSON context for an LLM chat, to log several values on one line, or to collect readings before a Convert template turns them into a sentence.

Ports#

PortDirectionSignalLanes
aInputData (any)1
bInputData (any)1
cInputData (any)1
dInputData (any)1
eInputData (any)1
fInputData (any)1
gInputData (any)1
hInputData (any)1
valueOutputData (json)1
triggerOutputData (trigger)1

Parameters#

ParameterLabelRangeDefaultUnitScaleNotes
whenWhen0 to 10linearEmit on every new input, or only once every connected input has a value. Choices: 0 Any, 1 All.

When (when)#

Any emits whenever any input changes, with whatever values have arrived so far. All waits until every cabled input has a value, then emits on each change after that.

Tips#

  • Only cabled ports appear in the object; leave unused letters free.
  • Use All when the downstream node needs every field, for example a template with several pointers.

See also#

Convert, LLM chat, Console log, Data cables.

Help patches

Each help patch is an ordinary Toy that teaches one idea. The diagram shows the Patch; the preview shows its Frame. Open it in TuneToys to play and edit it.

1. Two values, one object

beginner Teaches: when

Merge combines a number and a colour into one JSON object keyed by port once both have arrived.

Patch: Cron tick output connected to Random “number” trigger input. Cron tick output connected to Random “colour” trigger input. Random “number” value output connected to Merge a input. Random “colour” value output connected to Merge b input. Merge value output connected to Console log value input.
Connections as text
  • Cron tick output connected to Random “number” trigger input
  • Cron tick output connected to Random “colour” trigger input
  • Random “number” value output connected to Merge a input
  • Random “colour” value output connected to Merge b input
  • Merge value output connected to Console log value input
  • When All waits until every cabled input has a value; Any emits on each arrival.
Frame preview: Two values, one objectFrame “Two values, one object” with 2 elements: text heading, text hint.TWO VALUES, ONE OBJECTPress Play and open the Console: one object {"a": …, "b": …} per second.
Frame preview (static). Controls show their default values.

Open in TuneToys

  • Convert Convert a value to another datatype, optionally picking a field or formatting a string; failures go to error.
  • LLM chat Ask Anthropic, OpenAI or Gemini with your own vault key through the completion endpoint; text or JSON out.
  • Console log Write each incoming value to the Console panel with a level and label, rate-limited.

Edit this page on GitHub

esc

↑ ↓ move↩ open⌘↩ new tabesc close