Closed (fixed)
Project:
Migrate Plus
Version:
8.x-2.x-dev
Component:
Plugins
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
24 Dec 2015 at 22:31 UTC
Updated:
2 Apr 2019 at 07:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mikeryanComment #3
mikeryanWell, my current project has a more complex JSON feed than the depth-based selector can handle, so here goes... This patch maintains support for the depth method so existing JSON migrations won't break.
Comment #5
mikeryanAnother patch I wanted committed before beta2...
Comment #6
ressaThanks for all your work on the Migrate module. I am trying to create a JSON test import, but can't seem to get access to nested fields. Will I be able to do it with below code and latest dev-version 8.x-2.x-dev from 2016-Aug-05?
Comment #7
ressaTo answer my own question: Yes, it is possible. Just download the latest dev-version of Migrate Plus with
drush dl migrate_plus-8.x-2.x.Comment #9
mrmikedewolf commentedAwesome patch.
Comment #10
lquessenberry commentedHas this been rolled in by any chance? It is a wonderful patch and seems to be the only way I can get things to work properly with importers.
Comment #11
heddnYes, this is already closed. With links to where the patches were committed.
Comment #12
bobodrone commentedI have a somewhat complex JSON structure that (as I can see it) not can be parsed with either depth or path style right now. I need something like the JSON-path style syntax. See: https://github.com/FlowCommunications/JSONPath
I wonder if it could be a good idea to also use this approach?
I have a nested array where I also need to be able to iterate over each array of products to get all product_variations (commerce).
I can not just use the depth: 2 nor can I use: products/fields/product_variations since I need the parser to iterate over the outer array as well as the inner array. JSON path is a somewhat combination of depth and xpath style... kind of...
But With the "JSON path" syntax I could do either:
item_selector: $..product_variationsGet all nodes named product_variations from the root.
or :
item_selector: $.products.*.fields.product_variationsUse the * (or []) as a wildcard replacement for the outer array in my case.
Example json: (I need to migrate only ALL "product_variations")
I have tried to use that library in an extended version of the Json.php class in this module and it seams to work. But it would be interesting to hear what you think about this.
// Fredric
Comment #13
naveenvalechaAdding a related issue.
@bobodrone,
There's a patch in the #3007709: Add XPath-style filtering ability in JSON data parser plugin to provide the new JSON Parser plugin with the https://github.com/FlowCommunications/JSONPath Can you test your case with the new patch and see if there's anything needs to be improved.