github.com/GuanceCloud/cliutils@v1.1.21/pipeline/ptinput/funcs/md/rename.en.md (about) 1 ### `rename()` {#fn-rename} 2 3 Function prototype: `fn rename(new_key, old_key)` 4 5 Function description: Rename the extracted fields 6 7 Function parameters: 8 9 - `new_key`: new field name 10 - `old_key`: the extracted field name 11 12 Example: 13 14 ```python 15 # Rename the extracted abc field to abc1 16 rename('abc1', abc) 17 18 # or 19 20 rename(abc1, abc) 21 ``` 22 23 ```python 24 # Data to be processed: {"info": {"age": 17, "name": "zhangsan", "height": 180}} 25 26 # process script 27 json(_, info.name, "name") 28 29 # process result 30 { 31 "message": "{\"info\": {\"age\": 17, \"name\": \"zhangsan\", \"height\": 180}}", 32 "zhangsan": { 33 "age": 17, 34 "height": 180, 35 "Name": "zhangsan" 36 } 37 } 38 ```