獲取REST api數據並保存到json文件里
1.新建轉換
2.設置
(1)核心對象,拖拽
生成記錄,REST client,Json input,Json output
並依次連接(按shift+鼠標拖拽)
(2)編輯生成記錄
(3)編輯REST client
(4)編輯Json input
設置獲取的字段
說明:
根據返回的數據格式設置
{ "code": 200, "message": "SUCCESS", "data": { "total": 3, "list": [ { "id": 13, "fileName": "aa.txt", "size": 9084, "status": 5, "uploadTime": "2020-12-18 11:26:08", }, { "id": 12, "fileName": "bb.pdf", "size": 1729, "status": 5, "uploadTime": "2020-12-18 11:25:03", }, { "id": 11, "fileName": "cc.ppt", "size": 9451, "status": 5, "uploadTime": "2020-12-18 11:20:11", } ] } }
(4)編輯Json output
輸出字段
3.保存並執行
保存到json的數據為
{ "lists": [ { "fileName": "aa.txt", "fileSize": "9084", "id": "13" }, { "fileName": "bb.pdf", "fileSize": "1729", "id": "12" }, { "fileName": "cc.ppt", "fileSize": "9451", "id": "11" } ] }
附加:
不在url中指定參數size,使用post的formdata傳遞size
設置傳遞參數size