apoc.convert.setJsonProperty
Syntax |
|
||
Description |
Serializes the given JSON object and sets it as a property on the given |
||
Input arguments |
Name |
Type |
Description |
|
|
The node to set the JSON property on. |
|
|
|
The name of the property to set. |
|
|
|
The property to serialize as a JSON object. |
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
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;
map |
---|
{a: [4, 5, 6]} |