apoc.convert.setJsonProperty

Procedure APOC Core

apoc.convert.setJsonProperty(node,key,complexValue) - sets value serialized to JSON as property with the given name on the node

Signature

apoc.convert.setJsonProperty(node :: NODE?, key :: STRING?, value :: ANY?) :: VOID

Input parameters

Name Type Default

node

NODE?

null

key

STRING?

null

value

ANY?

null

Usage Examples

The examples in this section are based on the following sample graph:

CREATE (:Person {json:'{a:[1,2,3]}'});
MATCH (p:Person)
CALL apoc.convert.setJsonProperty(p, 'json', {a: [4,5,6]})
RETURN p
Table 1. Results
p

(:Person {json: "{\"a\":[4,5,6]}"})

We can extract the JSON value from the node using apoc.convert.getJsonPropertyMap:

MATCH (p:Person)
RETURN apoc.convert.getJsonPropertyMap(p, "json") AS map;
Table 2. Results
map

{a: [4, 5, 6]}