Skip to content

Data structure#

In Doc², all data passed between nodes is an array of objects. It has the following structure:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[
    {
        // For most data:
        // Wrap each item in another object, with the key 'json'
        "json": {
            // Example data
            "jsonKeyName": "keyValue",
            "anotherJsonKey": {
                "lowerLevelJsonKey": 1
            }
        },
        // For binary data:
        // Wrap each item in another object, with the key 'binary'
        "binary": {
            // Example data
            "binaryKeyName": {
                "data": "....", // Base64 encoded binary data (required)
                "mimeType": "image/png", // Best practice to set if possible (optional)
                "fileExtension": "png", // Best practice to set if possible (optional)
                "fileName": "example.png", // Best practice to set if possible (optional)
            }
        }
    },
]

Skipping the 'json' key and array syntax

From 0.166.0 onwards, Doc² automatically adds the json key if it is missing. It also automatically wraps your items in an array ([]) if needed.

Data flow#

Nodes do not only process one "item", they process multiple ones. For example, if the Trello node is set to Create-Card and it has an expression set for Name to be set depending on name property, it will create a card for each item, always choosing the name-property-value of the current one.

This data would, for example, create two cards. One named test1 the other one named test2:

1
2
3
4
5
6
7
8
[
    {
        name: "test1"
    },
    {
        name: "test2"
    }
]