toshiro92
toshiro92

Reputation: 1344

Combine apoc.convert.fromJsonMap with the CREATE query

Hi!

I am currently trying to insert a JSON data into neo4j with the apoc.convert.fromJsonMap. I want to combine the results of this command with the CREATE one.

First part worked and gave me a result:

WITH apoc.convert.fromJsonMap('{ "name": "Emil", "from": "Sweden", "klout": 99 }') AS pers

But when I want to combine it by creating a new node like this :

CREATE (ee:Person pers)

I have the following error:

Neo.ClientError.Statement.SyntaxError: Invalid input 'p': expected whitespace, comment, NodeLabel, MapLiteral, a parameter, ')' or a relationship pattern (line 2, column 19 (offset: 109)) "CREATE (ee:Person pers)"

I do not know how to pass results of into the CREATE query. Any help will be very appreciated :-)

Thank you.

Upvotes: 0

Views: 461

Answers (1)

logisima
logisima

Reputation: 7478

Just do this :

WITH apoc.convert.fromJsonMap('{ "name": "Emil", "from": "Sweden", "klout": 99 }') AS pers
CREATE (ee:Person)
SET ee = pers
RETURN ee

Upvotes: 2

Related Questions