0

We are trying to pull in some data from an outside source that serves JSON.

The structure of said json is like this:

[
    {
        "name":"something",
        "desc":"some kind of desc.",
        "tags": [
            {
                "order":"3",
                "displayName":"Tag1"
            },
            {
                "order":"13",
                "displayName":"Tags 101"
            },
            {
                "order":"28",
                "displayName":"Dogs"
            }
        ]
    }, ...

]

We want to implode all tags.displayName values into one string. I'll use the body field as an example. In the UI, if you view the content, "body" would be:

Tag1|Tags 101|Dogs

In the "fields" section of my migration source yml file:

name: tagsCollection
label: "tagsCollection"
selector: tags

Then, in the process section of the YML file I've tried this:

body:
    plugin: concat
    delimiter: "|"
    source:
     - stepsCollection

I've also looked into the iterator plugin. Nothing seems to click.

If I do this in the process section of the yml file:

body: stepsCollection

body will be "Array" in the UX. So it is aware that there is an array in that var.

What am I missing?? Many thanks

0

The documentation examples of concat plugin use a flat, non-associative array of strings as source, you are trying to concat a nested array of JSON objects. You could try to subprocess your tags to only fetch/concat the displayName from them

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.