You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Postman中传递Swagger定义的复杂结构字段?

How to Pass the Nested values Parameter in Postman for Your Swagger API

Hey there! Let's walk through exactly how to handle that nested values parameter you're working with. First, let's clarify the structure you're dealing with—it's a nested JSON object, not just a random long string, so we need to make sure Postman sends it in the right format.

Case 1: Parameter is in the Request Body (Most Common for POST/PUT)

If your Swagger defines this as part of the request body (which is typical for create/update operations), follow these steps:

  • Open your request in Postman and switch to the Body tab.
  • Select the raw option, then choose JSON from the dropdown menu next to it.
  • Paste the full JSON structure into the editor—make sure it's properly formatted like this:
    {
      "values": {
        "date": {
          "date": "2021-01-15",
          "time": "12:30am"
        }
      }
    }
    
  • Double-check that the Content-Type header is set to application/json (Postman will add this automatically when you select the JSON raw format, but it never hurts to verify!).

Case 2: Parameter is a Query Parameter (Less Common)

If your Swagger specifies this as a query parameter (unlikely for nested objects, but possible), you'll need to pass it as a URL-encoded JSON string:

  • Go to the Params tab in Postman.
  • Add a new parameter with the key values.
  • For the value, paste the nested JSON as a single string:
    {"date":{"date":"2021-01-15","time":"12:30am"}}
    
  • Postman will automatically URL-encode this string for you when sending the request, so you don't have to do that manually.

Pro Tip

If you haven't already, import your Swagger document directly into Postman (via the Import button, selecting your Swagger JSON/YAML file). Postman will generate pre-built request templates with all the fields mapped out—you just need to fill in the values for date and time in the appropriate nested fields, which eliminates the chance of formatting errors.

内容的提问来源于stack exchange,提问作者mstdmstd

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.29 07:34:05