json_add(key,data)
Parameter Name | Parameter Description | Parameter Type | Required | Parameter Default Value | Parameter Value Range |
key | json key | string | Yes | - | - |
data | Add a new node | dict | Yes | - | - |
{"content": "{\\"a\\":{\\"b\\":{\\"c\\":\\"cc\\"}}}"}
json_add("content", {"a":{"b":{"d":"dd"}}})
{"content": "{\\"a\\":{\\"b\\":{\\"c\\":\\"cc\\",\\"d\\":\\"dd\\"}}}"}
json_edit("result", path="", key="",value="333",index=1,mode="edit")
Parameter | Description | Type | Required | Default Value | Value Range |
field | Nested json corresponding key | string | Yes | - | - |
path | Need to delete or modify the directory corresponding to the target field. When the field to be deleted or modified is at the first level of nested json, leave it blank; when operating on array elements, fill in up to the key corresponding to the array. Support JMES grammar. | string | No | - | - |
key | Target field that needs to be deleted or modified. No need to specify when performing operations on array elements. | string | No | - | - |
value | New value to be set, required when modifying a value | string | No | - | - |
index | Fill in this field when operating on an array. Array elements start from 1. | number | No | 0 | - |
mode | mode, edit: modify, move: delete, default move | string | No | move | - |
{"content":"{\\"p9\\":[\\"0.0\\",\\"0.0\\"],\\"p18\\":\\"CN\\"}","time":"1650440364"}
json_edit("content", path="", key="p18", value="hello", mode="edit")
{"content":"{\\"p9\\":[\\"0.0\\",\\"0.0\\"],\\"p18\\":\\"hello\\"}", "time":"1650440364"}
{"content":"{\\"p9\\":[\\"0.0\\",\\"0.0\\"],\\"p18\\":\\"CN\\",\\"info\\":{\\"province\\":\\"hubei\\",\\"geo\\":{\\"long\\":\\"111\\",\\"lati\\":\\"222\\"}}}","time":"1650440364"}
json_edit("content", path="info.geo", key="long", value="333", mode="edit")
{"content":"{\\"p9\\":[\\"0.0\\",\\"0.0\\"],\\"p18\\":\\"CN\\",\\"info\\":{\\"province\\":\\"hubei\\",\\"geo\\":{\\"long\\":\\"333\\",\\"lati\\":\\"222\\"}}}","time":"1650440364"}
{"content":"{\\"p9\\":[\\"0.0\\",\\"0.0\\"],\\"p18\\":\\"CN\\",\\"info\\":{\\"province\\":\\"hubei\\",\\"geo\\":{\\"long\\":\\"111\\",\\"lati\\":\\"222\\"}}}","time":"1650440364"}
json_edit("content", path="", key="p18", mode="move")
{"content":"{\\"p9\\":[\\"0.0\\",\\"0.0\\"],\\"info\\":{\\"province\\":\\"hubei\\",\\"geo\\":{\\"long\\":\\"111\\",\\"lati\\":\\"222\\"}}}","time":"1650440364"}
{"content":"{\\"p9\\":[\\"0.0\\",\\"0.0\\"],\\"p18\\":\\"CN\\",\\"info\\":{\\"province\\":[\\"hello\\",\\"world\\"],\\"geo\\":{\\"long\\":[\\"1.0\\",\\"2.0\\"],\\"lati\\":\\"222\\"}}}","time":"1650440364"}
json_edit("content", path="info.province", index=1, mode="move")
{"content":"{\\"p9\\":[\\"0.0\\",\\"0.0\\"],\\"p18\\":\\"CN\\",\\"info\\":{\\"province\\":[\\"world\\"],\\"geo\\":{\\"long\\":[\\"1.0\\",\\"2.0\\"],\\"lati\\":\\"222\\"}}}","time":"1650440364"}
json_select(data, jmes="")
Parameter | Description | Type | Required | Default Value | Value Range |
data | Field value, which can be extracted by other functions. | string | Yes | - | - |
jmes | string | Yes | - | - |
{"field": "{\\"a\\":{\\"b\\":{\\"c\\":{\\"d\\":\\"success\\"}}}}", "status": "500"}
fields_set("message", json_select(v("field"), jmes="a.b.c.d"))
{"field":"{\\"a\\":{\\"b\\":{\\"c\\":{\\"d\\":\\"success\\"}}}}","message":"success","status":"500"}
xml_to_json(data)
Parameter | Description | Type | Required | Default Value | Value Range |
data | Field value. | string | Yes | - | - |
{"xml_field": "<note><to>B</to><from>A</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note>", "status": "500"}
fields_set("json_field", xml_to_json(v("xml_field")))
{"xml_field":"<note><to>B</to><from>A</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note>","json_field":"{\\"to\\":\\"B\\",\\"from\\":\\"A\\",\\"heading\\":\\"Reminder\\",\\"body\\":\\"Don't forget me this weekend!\\"}","status":"500"}
json_to_xml(data)
Parameter | Description | Type | Required | Default Value | Value Range |
data | Field value. | string | Yes | - | - |
{"json_field":"{\\"to\\":\\"B\\",\\"from\\":\\"A\\",\\"heading\\":\\"Reminder\\",\\"body\\":\\"Don't forget me this weekend!\\"}", "status": "200"}
fields_set("xml_field", json_to_xml(v("json_field")))
{"json_field":"{\\"to\\":\\"B\\",\\"from\\":\\"A\\",\\"heading\\":\\"Reminder\\",\\"body\\":\\"Don't forget me this weekend!\\"}","xml_field":"<ObjectNode><to>B</to><from>A</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></ObjectNode>","status":"200"}
if_json(data)
Parameter | Description | Type | Required | Default Value | Value Range |
data | Field value. | string | Yes | - | - |
{"condition":"{\\"a\\":\\"b\\"}","status":"500"}
t_if(if_json(v("condition")), fields_set("new", 1))
{"new":"1","condition":"{\\"a\\":\\"b\\"}","status":"500"}
{"condition":"haha","status":"500"}
t_if(if_json(v("condition")), fields_set("new", 1))
{"condition":"haha","status":"500"}
array_get(array, index_position)
Parameter | Description | Type | Required | Default Value | Value Range |
Array | Array | string | Yes | - | - |
index_position | Get the value at a specific index in an array | int | Yes | - | - |
{"field1": "[1,2,3]"}
fields_set("field2", array_get(v("field1"), 0))
{"field1":"[1,2,3]","field2":"1"}
{"field1": "['tom','jerry','bobo']"}
fields_set("field2", array_get(v("field1"), 0))
{"field1":"['tom','jerry','bobo']","field2":"tom"}
Feedback