8 – D8 – Import a taxonomy with a hierarchy via josn_api

I use JSON: API to migrate data from one Drupal 8 site to another and to successfully migrate taxonomy terms. However, the hierarchy is not preserved.

My taxonomy migration looks like this:

langcode: in
status: true
id: migration_taxonomy_tags
label: import taxonomy
group_migration: import_production
dependencies_migration: {}
dependencies: {}
destination:
plugin: entity: taxonomy_term
default_bundle: tags

source:
plugin: url
data_fetcher_plugin: http
data_parser_plugin: json
constants:
source_base_path: https: //sitename.com/'
URL: https://sitename.com/jsonapi/taxonomy_term/tags?_format=api_json

login:
tid:
type: whole

item_selector: data /

the fields:
-
name: tid
label: 'Tid & # 39;
selector: / attributes / tid
-
name: uuid
label: 'Uuid & # 39;
selector: / attributes / uuid
-
name name
name of the label & # 39;
selector: / attributes / name
-
name: changed
label: "Changed"
selector: / attributes / changed
-
name: status
label: 'Status & # 39;
selector: / attributes / status
-
name: description
label: 'Description & # 39;
selector: / attributes / description
-
name: path
label: 'Path & # 39;
selector: / attributes / path
-
name: parent
label: "Parent"
selector: / relations / parent

process:
type:
plugin: default_value
default_value: taxonomy

tid: tid
uuid: uuid
name name
changed: changed
status: status
path: path
description: description

Parent:
plugin: migration_lookup
migration: migration_taxonomy_tags
source: parent

and the endpoint returns formatted data as such:

{
type: "taxonomy_term - Geographic_location",
id: "34f9b380-f976-4ed9-8517-916d47320cea",
attributes: {
719
uuid: "34f9b380-f976-4ed9-8517-916d47320cea",
langcode: "en",
status: true,
name: "Africa",
description: null,
changed: 1533567134,
way: {
alias: "/ taxonomy / tags / africa",
pid: 873,
langcode: "in"
}
}
relationships: {
vid: {
The data: {
type: "taxonomy_vocabulary - taxonomy_vocabulary",
id: "e793ed10-5343-4acb-bd36-4230e5c0dfb5"
}
connections: {
self: "http: //sitename....320cea/relationships/vid",
related: "http: //sitename....d9-8517-916d47320cea/vid"
}
parent: {
The data: {
0: {
type: "taxonomy_term - Geographic_location",
id: "virtual",
meta: {
connections: {
Help me: {
href: "https://www.drupal.org/d...pi/core-concepts#virtual",
meta: {...}
}
}
}
}
connections: {
self: "http://sitename.com/relationships/parent",
related: "http: //sitename....8517-916d47320cea/parent" "
}
}
}
}
}
}

I saw an answer to import CSV with the hierarchy, but that assumes a PID field. Unfortunately, the endpoint created by the JSON API does not return it.