使用WITH在Neo4j中导入JSON:无效输入':'

时间:2016-09-14 12:11:02

标签: json neo4j

我正在尝试将JSON导入Neo4j。

我正在使用这样的东西:

WITH [{addr:[],phone:[],email:[{value:"cdd@fake.com"}],first_name:null,last_name:null},{addr:[],phone:[],email:[{value:"ffd@rotterdam.nl"}],first_name:"Jo",last_name:null},{addr:[],phone:[],email:[{value:"yeh@hdn.nl"}],first_name:"Jenno",last_name:null},{addr:[],phone:[],email:[{value:"doe@doe.com"}],first_name:"John",last_name:"Doe"},{addr:[],phone:[],email:[{value:"me@doe.com"}]

但是我收到了这个错误:

Invalid input ':': expected '0'-'9', whitespace or '}' (line 1, column 1763 (offset: 1762))

它能是什么?我已经明白不应该引用键,值不能是“”空字符串。

1 个答案:

答案 0 :(得分:0)

你的json无效,它最后错过了一些结尾括号,这适合我:

WITH [{addr:[],phone:[],email:[{value:"cdd@fake.com"}],first_name:null,last_name:null},{addr:[],phone:[],email:[{value:"ffd@rotterdam.nl"}],first_name:"Jo",last_name:null},{addr:[],phone:[],email:[{value:"yeh@hdn.nl"}],first_name:"Jenno",last_name:null},{addr:[],phone:[],email:[{value:"doe@doe.com"}],first_name:"John",last_name:"Doe"},{addr:[],phone:[],email:[{value:"me@doe.com"}]}] AS elts
UNWIND elts AS elt
RETURN elt

-

╒══════════════════════════════╕
│elt                           │
╞══════════════════════════════╡
│{first_name: (null), email: [{│
│value: cdd@fake.com}], last_na│
│me: (null), addr: [], phone: [│
│]}                            │
├──────────────────────────────┤
│{first_name: Jo, email: [{valu│
│e: ffd@rotterdam.nl}], last_na│
│me: (null), addr: [], phone: [│
│]}                            │
├──────────────────────────────┤
│{first_name: Jenno, email: [{v│
│alue: yeh@hdn.nl}], last_name:│
│ (null), addr: [], phone: []} │
├──────────────────────────────┤
│{first_name: John, email: [{va│
│lue: doe@doe.com}], last_name:│
│ Doe, addr: [], phone: []}    │
├──────────────────────────────┤
│{addr: [], phone: [], email: [│
│{value: me@doe.com}]}         │
└──────────────────────────────┘