json_add(key,data)
パラメータ名 | パラメータ説明 | パラメータタイプ | 必須かどうか | パラメータのデフォルト値 | パラメータの値の範囲 |
key | jsonに対応するキー | string | はい | - | - |
data | 新しいノードを補充します。 | dict | はい | - | - |
{"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")
パラメータ名 | パラメータ説明 | パラメータタイプ | 必須かどうか | パラメータのデフォルト値 | パラメータの値の範囲 |
field | ネストされたjsonに対応するキー | string | はい | - | - |
path | 削除または変更する対象フィールドに対応するディレクトリです。削除または変更するフィールドがネストされたjsonの第1階層である場合は、入力しません。配列要素を操作する場合は、配列に対応するkeyまで入力します。JMES構文をサポートします。 | string | いいえ | - | - |
key | 削除または変更する対象フィールドです。配列要素を操作する場合は、入力不要です。 | string | いいえ | - | - |
value | 設定が必要な新しい値です。値を変更する場合のみ入力します。 | string | いいえ | - | - |
index | 配列を操作する場合にこのフィールドを入力します。配列要素は1から始まります。 | number | いいえ | 0 | - |
mode | モードです。変更:edit、削除:move。デフォルトはmoveです。 | string | いいえ | 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="")
パラメータ名 | パラメータ説明 | パラメータタイプ | 必須かどうか | パラメータのデフォルト値 | パラメータの値の範囲 |
data | フィールド値は、他の関数を使用して抽出できます。 | string | はい | - | - |
jmes | string | はい | - | - |
{"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"}
json_update(json値, key1, value1, key2, value2)
パラメータ名 | パラメータ説明 | パラメータタイプ | 必須かどうか | パラメータのデフォルト値 | パラメータの値の範囲 |
field | jsonに対応するキー | string | はい | - | - |
可変パラメータ | jsonに追加するkey valueペア | string | はい | - | - |
{"data": "{\\"c\\":\\"d\\"}"}
json_update("data", "11", "22")
{"data":"{\\"11\\":\\"22\\",\\"c\\":\\"d\\"}"}
{"data": "{\\"c\\":\\"d\\"}","name": "テスト","timestamp": 1734567890,"status": true}
json_update("data", "11", "11", "22", "22", "33")
{"data":"{"11":"11","22":"22","c":"d"}","name":"テスト","status":"true","timestamp":"1734567890"}
xml_to_json(data)
パラメータ名 | パラメータ説明 | パラメータタイプ | 必須かどうか | パラメータのデフォルト値 | パラメータの値の範囲 |
data | フィールド値 | string | はい | - | - |
{"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)
パラメータ名 | パラメータ説明 | パラメータタイプ | 必須かどうか | パラメータのデフォルト値 | パラメータの値の範囲 |
data | フィールド値 | string | はい | - | - |
{"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)
パラメータ名 | パラメータ説明 | パラメータタイプ | 必須かどうか | パラメータのデフォルト値 | パラメータの値の範囲 |
data | フィールド値 | string | はい | - | - |
{"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(配列、添字位置)
パラメータ名 | パラメータ説明 | パラメータタイプ | 必須かどうか | パラメータのデフォルト値 | パラメータの値の範囲 |
配列 | 配列 | string | はい | - | - |
添字位置 | 配列の何番目の値を取得します。 | int | はい | - | - |
{"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"}
フィードバック