Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-08-2021 05:33 AM
One of my API results is returning a JSON string that is non-escaped. I am trying to set the JSON value to a string and then load the data into Neo4J.
Getting below error:
Invalid input '"': expected 'n/N' or 's/S' (line 8, column 13 (offset: 100))
" "a":"b' a""
WITH '
{
"total": 31,
"limit": 10,
"offset": 0,
"results": [
{"a":"b' a"},
{"a":"c"},
{"a":"d"},
{"a":"e"},
{"a":"f"},
{"a":"g"},
{"a":"h"},
{"a":"i"},
{"a":"j"},
{"a":"k"},
]
}
' as jsonString
with apoc.convert.fromJsonMap(jsonString) as value
return value
03-09-2021 08:35 AM
You can escape the '
with a \'
, but there is also an issue with a trailing ,
in the results
part of the map.
WITH '
{
"total": 31,
"limit": 10,
"offset": 0,
"results": [
{"a":"b\' a"},
{"a":"c"},
{"a":"d"},
{"a":"e"},
{"a":"f"},
{"a":"g"},
{"a":"h"},
{"a":"i"},
{"a":"j"},
{"a":"k"}
]
}
' as jsonString
with apoc.convert.fromJsonMap(jsonString) as value
return value
All the sessions of the conference are now available online