I have a JSON that can hold single or multi values arrays and I can't make subprocess + migration_lookup behave consistently. It correctly imports the nodes in all cases, but it adds the reference to the imported nodes (entity reference field) only when I have more than 1 item in my array.
my JSON can looks like this:
"behaviour": [
{
"name": "behaviour name",
"description": "behaviour description"
}
]
or like this:
"behaviour": [
{
"name": "behaviour name",
"description": "behaviour description"
},
{
"name": "another behaviour name",
"description": "another behaviour description"
}
]
the process part of my migration config:
field_behaviour:
plugin: sub_process
source: behaviour_array
process:
target_id:
plugin: migration_lookup
migration: import_behaviours_json
source: name
At the moment I'm investigating if this is related or not with https://www.drupal.org/project/drupal/issues/2890690 (at a first sight those don't seem related)
Comments
Comment #2
stefan vaduva commentedComment #3
stefan vaduva commentedIt urned out the issue was related with migrate_source_jsonpath (the modules used to grab data from JSON). So I'll close this one.
Just for reference, migrate_source_jsonpath was returning single items as strings instead of array