Sending (nested) json object with file using Postman

独自空忆成欢 提交于 2019-12-07 06:44:36

问题


With Postman, I can attach files in requests with form-data, I can also send nested JSON object in raw format, but how can I do both: sending nested-structure data with file, e.g:

"data": {
    "normal_fields": {
        "field1": "value1",
        "field2": "value2"
    },
    "image_file": <file>
}

回答1:


Try setting values like below and choose file to upload.




回答2:


It didn't worked for me like that. For me only worked this way:

property[nested_field1]
property[nested_field2]

or arrays with objects:

array[0][nested_field1]
array[0][nested_field2]
array[1][nested_field1]
array[1][nested_field2]


来源:https://stackoverflow.com/questions/30351869/sending-nested-json-object-with-file-using-postman

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!