pavloN
(pavloN)
1
Could I use apoc.convert.fromJsonList inside apoc.periodic.iterate?
Where are the mistakes in this query?
CALL apoc.periodic.iterate('
apoc.convert.fromJsonList('[1,2,3]') as v RETURN v'
,'
MERGE (person:Person {name:"Bob"})
',
{ batchSize: 10000, iterateList: true, parallel:true });
I think you might be after something like this:
CALL apoc.periodic.iterate(
'RETURN apoc.convert.fromJsonList("[1,2,3]") AS v',
'UNWIND v as item MERGE (person:Person {name:"Bob-" + item})',
{ batchSize: 10000, iterateList: true, parallel:true })
1 Like
pavloN
(pavloN)
3
Thank for your response!
But If I want process the JSON. What kind of quotes I need to use?
CALL apoc.periodic.iterate(
'RETURN apoc.convert.fromJsonList("[
{
"id": "01",
"name": "Bob",
"home": {
"main": ["first"],
"alternate": []
}
},
{
"id": "02",
"name": "Rome",
"home": {
"main": ["second"],
"alternate": []
}
}]") AS v',
'UNWIND v as item MERGE (person:Person {name:"Bob-" + item})',
{ batchSize: 10000, iterateList: true, parallel:true })
I see the error:
Neo.ClientError.Procedure.ProcedureCallFailed: Failed to invoke procedure apoc.periodic.iterate
: Caused by: org.neo4j.cypher.internal.v3_5.util.SyntaxException: Invalid input 'd': expected 'n/N' or 's/S' (line 3, column 7 (offset: 69))