Hello everyone,
I am currently working on a graph-db project and have a problem. I can't build a graph in neo4j from a "Meetup"-JSON. I try the following command:
WITH "https://api.meetup.com/UX-Basel-Meetups/events?key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx&status=past" AS url
CALL apoc.load.json(url) YIELD value
unwind value as event
return event
the following error is given by neo4j:
Neo.ClientError.Statement.SyntaxError: Type mismatch: expected List<T> but was Map (line 3, column 8 (offset: 162))
"unwind value as event"
It expects a list instead of a map. But in other examples I found in the forum, a JSON is treated that way.
Can you please help me with this? :)
Many thanks
Malik
Can you provide an example of the JSON returned? Take a look at it yourself, it is indeed a map, so you'll need to figure out what keys are important to you, and what map entries are lists that you'll want to UNWIND instead (UNWIND can only operate on lists...it changes a row with a list such that there is a separate row per list entry...basically the opposite of a collect()).
Thanks for the answer.
I want to completely unwind the JSON. The thing is, the outermost element has no key. (For the rest, I can address inner elements with the key without any problems.) Do you have a tip how I can solve this?
Here is the JSON:
[
{"created":1544476733000,"duration":7200000,"id":"257113229","name":"UX Meetup Februar" },
{"created":1549386834000, "duration": 7200000, "id":"258704617","name":"UX Meetup März"},
.......
]
Ah, in that case try using the procedure apoc.load.jsonArray()
instead, that should have a YIELDED value that can be a list rather than a map, you should be able to UNWIND it.