How do I read an array of simple values?

In your input data, you may need to read data which is in an array of simple values, such as an array of Strings, like this:

{
    "indicators": [
        "EXAMPLE",
        "INFORMATION",
        "FINAL"
    ],
    // ...
}

But the field Instruction needs a source which specifies a property on a JavaScript Object, so when you iterate over the array with the for-each Instruction, you don’t have a property you can access.

To access this value, set "wrapValues":true in your for-each Instruction. This makes the array look like this:

{
    "indicators": [
        {"value":"EXAMPLE"},
        {"value":"INFORMATION"},
        {"value":"FINAL"}
    ],
    // ...
}

and now you can access it with "source":"value".

For example, to set a multi-value property from this input data, you would use Instructions like this:

{
    "action": "remove-values",
    "destination": "phd:project",
    "name": "example:attribute:service-indicator"
},
{
    "action": "for-each",
    "source": "indicators",
    "wrapValues": true,
    "instructions": [
        {
            "source": "value",
            "destination": "phd:project",
            "name": "example:attribute:service-indicator",
            "multivalue": true,
            "refMapping": "service-indicator"
        }
    ]
}