Versions: Neo4j 3.2.2 Community; APOC 3.2.0.3
Escaped characters in strings are not handled correctly in all instances.
This works as expected:
WITH apoc.convert.fromJsonMap( '{"a":42,"b":"foo\\bar","c":[1,2,3]}') AS p RETURN p.b
╒═════════╕
│"p.b" │
╞═════════╡
│"foo\bar"│
└─────────┘
Escaping quotes does not work as expected:
WITH apoc.convert.fromJsonMap( '{"a":42,"b":"\"foo\"","c":[1,2,3]}')
AS p RETURN p.b
Neo.ClientError.Procedure.ProcedureCallFailed
Failed to invoke function apoc.convert.fromJsonMap
: Caused by: java.lang.RuntimeException: Can't convert {"a":42,"b":""foo"","c":[1,2,3]} to Map with path
Doubling down on the reverse solidus (not desirable) gives this result:
WITH apoc.convert.fromJsonMap( '{"a":42,"b":"\\"foo\\"","c":[1,2,3]}') AS p RETURN p.b
╒═════════╕
│"p.b" │
╞═════════╡
│"\"foo\""│
└─────────┘
An escaped newline character gets the same error:
WITH apoc.convert.fromJsonMap( '{"a":42,"b":"foo\nbar","c":[1,2,3]}') AS p RETURN p.b
Neo.ClientError.Procedure.ProcedureCallFailed
Failed to invoke function apoc.convert.fromJsonMap
: Caused by: java.lang.RuntimeException: Can't convert {"a":42,"b":"foo
bar","c":[1,2,3]} to Map with path
[Note that the newline after "foo" is represented in the string returned by the error message. The error message is given on two lines.]
Is my usage of this procedure correct?
Has anyone seen this problem and fixed or worked around it?