cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Import json data by using APOC [HELP]

Dear developers please help me!
I want to import json data into neo4j database. Now this is my data in Mongodb.
3X_0_d_0d754f7bb351b8e6d1e74c0659d2a1d2a62598ad.png

I want to import like that:

Here is my cipher SQL:

CALL apoc.load.json("file:///data.json")
yield values unwind values as value
merge (general_info:Company {id: value.info.register_number})
on create set general_info.name = value.info.company_name,
			  general_info.form = value.info.company_form,
              general_info.type = value.info.company_type,
              general_info.numberOfOwner = value.info.number_of_owner,
              general_info.companyLocation = value.info.company_location,
              general_info.registerDate = value.info.regiter_date
with value.stakeHolders as stakeHolder
merge (stake:Person {id: stakeHolder.last_name+'.'+stakeHolder.first_name})
on create set stake.firstName = stakeHolder.first_name,
			  stake.lastName = stakeHolder.last_name,
              stake.country = stakeHolder.country,
              stake.category = stakeHolder.category,
              stake.registeredDate = stakeHolder.date
merge (stake)-[rel:OWNED]->(general_info)
with value.ceo as ceos
merge (cc:Person {id: ceos.last_name+'.'+ceos.first_name})
on create set cc.firstName = ceos.first_name,
			  cc.lastName = ceos.last_name,
              cc.country = ceos.country,
              cc.category = ceos.category,
              cc.registeredDate = ceos.date
merge (cc)-[rel1:CEO]->(general_info)
with value.area as areas
merge (arr:Area {id: areas.code})
on create set arr.title = areas.title,
			  arr.registeredDate = areas.date
merge(arr)-[rel2:HAS_AREA]->(general_info)
return values
2 REPLIES 2

Hi @nyamkhuu.bu ,

did you had a chance to try MongoDB - APOC Documentation ?

clem
Graph Steward

Do you have sample JSON data you're trying to import (in which case I'll try to take a look) or are you trying to import directly from MongoDB (which I know nothing about)?