github.com/GuanceCloud/cliutils@v1.1.21/pipeline/ptinput/funcs/md/load_json.en.md (about)

     1  ### `load_json()` {#fn-load-json}
     2  
     3  Function prototype: `fn load_json(val: str) nil|bool|float|map|list`
     4  
     5  Function description: Convert the JSON string to one of map, list, nil, bool, float, and the value can be obtained and modified through the index expression.If deserialization fails, it also returns nil instead of terminating the script run.
     6  
     7  Function parameters:
     8  
     9  - `val`: Requires data of type string.
    10  
    11  Example:
    12  
    13  ```python
    14  # _: {"a":{"first": [2.2, 1.1], "ff": "[2.2, 1.1]","second":2,"third":"aBC","forth":true},"age":47}
    15  abc = load_json(_)
    16  
    17  add_key(abc, abc["a"]["first"][-1])
    18  
    19  abc["a"]["first"][-1] = 11
    20  
    21  # Need to synchronize the data on the stack to point
    22  add_key(abc, abc["a"]["first"][-1])
    23  
    24  add_key(len_abc, len(abc))
    25  
    26  add_key(len_abc, len(load_json(abc["a"]["ff"])))
    27  ```