函数 JSON_merge() 可以将两个符合 JSON 格式的字符串合并为一个新的符合 JSON 格式的字符串,并返回该字符串。
Arguments:
- 字符串1 <string | text>
- 字符串2 <string | text>
Returns:
- 字符串 <string>
一般用法
示例:异源别名直接计算
uncollect ['{"name":"Lisa"}', '{"age":23}'] as s1
uncollect ['{"birthyear":1998}', '{"industry":"education"}'] as s2
return JSON_merge(s1, s2)
| JSON_merge(s1, s2) |
|-----------------------------------|
| {"birthyear":1998,"name":"Lisa"} |
| {"age":23,"industry":"education"} |
示例:异源别名笛卡尔积后计算
uncollect ['{"name":"Lisa"}', '{"age":23}'] as s1
uncollect ['{"birthyear":1998}', '{"industry":"education"}'] as s2
with JSON_merge(s1, s2) as s
return s
| s |
|----------------------------------------|
| {"birthyear":1998,"name":"Lisa"} |
| {"industry":"education","name":"Lisa"} |
| {"age":23,"birthyear":1998} |
| {"age":23,"industry":"education"} |