0

I would like to import content with feeds module with JSONPath extensible parser and create nodes of them.

When I have a hierachical JSON with a parent, the mapping is working like a charme (e.g. context: $.article.* / source: $..title).

My problem occures, when the JSON contains a single content (that should be imported to a single node) and all relevant elements are on the first/root level. This guy had a similar problem, although in my case I even do only have one content per JSON doc (Link), but with the suggested solutions I do not get it work.

{

"identifier": "test0004",

"title": "This is a title",

"application": "Drupal",

}

I don't have any clue, what context and what source I have to define, to make it work. As context I desperately tried-I believe-everything, amongst others:

  • .
  • .*
  • $
  • $.*
  • $[]

And as source $.title, $title, title etc.

What I am doing wrong?

  • 1
    I've tried a few things, can't get it to work either. However, I'm working on adding support for the library "flow/jsonpath" in the D8 version of Feeds extensible parsers. With that library, I can confirm that just a dot . works as context in this case. Tested on jsonpath.curiousconcept.com/#jsonpath. Do note that your JSON example has an error: the comma after the last item should be removed. – MegaChriz Jan 8 at 14:12
  • Thank you for you efforts in testing and reproducing my problem. I installed flow/jsonpath. So it seems to be a module problem? – Benjamin Jan 8 at 15:09
  • 1
    A module problem - yes and no. Feeds extensible parsers cannot handle this use case with the peekmo/jsonpath library, but with flow/jsonpath it could. But the D8 version of Feeds extensible parsers does not yet support flow/jsonpath. I'm close to finalize that, however. – MegaChriz Jan 8 at 15:31
  • Thank you for the information and thank you for your efforts to improve the module. – Benjamin Jan 9 at 13:29

Your Answer

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

Browse other questions tagged or ask your own question.