i want to make a node in neo4j from json data, named with the username(unique), and having as proprieties the created_time(int) and info(a list)
{
"ProfileInfo": {
"created_time": 1286323200,
"info": {
"biography": "",
"followers_count": 5000,
"following_count": 1000,
"full_name": "alpha beta",
"id": 123456789,
"is_business_account": true,
"is_joined_recently": false,
"is_private": false,
"posts_count": 1,
},
"username": "alphabeta"
}
}
i tried to run this command in cypher:
Call apoc.load.json("file:/Neo4j/data/alpha_sample.json") YIELD value AS user
MERGE (u:USER {username:user.ProfileInfo.username})
SET u.created_time = user.ProfileInfo.created_time,
u.info = user.ProfileInfo.info
but i get this error,
Property values can only be of primitive types or arrays thereof
Does anyone have any idea of how i can do this ? any help is welcome
You will need to extract out each element in ProfileInfo.username. Does something like this help?
CALL apoc.load.json("file:/Neo4j/data/alpha_sample.json") YIELD value AS user
MERGE (u:USER {username:user.ProfileInfo.username})
SET u.created_time = user.ProfileInfo.created_time,
u += user.ProfileInfo.info