Unlimited fields are feeded with multiple "Array" instead of source array's values

Created on 31 July 2022, over 2 years ago
Updated 2 October 2023, about 1 year ago

Problem/Motivation

Multiple value fields are not correctly populated on Drupal by arrays in the source: result is always "Array" (an array of "Array" texts!)

Steps to reproduce

I'm trying to get the "amount"s values imported to a multiple values text field.
The source is like this:

{
    "account_responses": [
        {
            "account": {
                "name": "xxx",
                "address": "yyy"
            },
            "balance": {
                "denom": "aaa",
                "amount": "111"
            }
        },
        {
            "account": {
                "name": "www",
                "address": "zzz"
            },
            "balance": {
                "denom": "bbb",
                "amount": "222"
            }
        }
    ],
    "other_stuff": {}
}

Set up the Feed type like this:
- Fetcher: download from URL
- Parser: JsonPath
- Mapping:
-- Context: *
-- Source: account_responses
-- Target: my_text_field (plain, long, unlimited values)

Import result (my_text_field):
- value1: Array
- value2: Array

I should get instead (trimming whitespace here for readability):
- value1: "account": { "name": "xxx", "address": "yyy" }, "balance": { "denom": "aaa", "amount": "111" }
- value2: "account": { "name": "www", "address": "zzz" }, "balance": { "denom": "bbb", "amount": "222" }

Proposed resolution

(can't code yet and haven't studied Feeds enough yet to help)

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇮🇹Italy kopeboy Milan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States dasginganinja Bethlehem, PA

    Can we get context for what array key is being processed in the tamper function?

    I have a similar problem to this where my incoming data is an array and this tamper runs on every array item instead of the array itself. I expected $data to be an array since that was the source....

    How do we get an array to the tamper when we originally passed an array? This is a source value that has an array. I'm so confused about the mechanics of this @megachriz

Production build 0.71.5 2024