<small id='3lsqM'></small><noframes id='3lsqM'>

<tfoot id='3lsqM'></tfoot>
<i id='3lsqM'><tr id='3lsqM'><dt id='3lsqM'><q id='3lsqM'><span id='3lsqM'><b id='3lsqM'><form id='3lsqM'><ins id='3lsqM'></ins><ul id='3lsqM'></ul><sub id='3lsqM'></sub></form><legend id='3lsqM'></legend><bdo id='3lsqM'><pre id='3lsqM'><center id='3lsqM'></center></pre></bdo></b><th id='3lsqM'></th></span></q></dt></tr></i><div id='3lsqM'><tfoot id='3lsqM'></tfoot><dl id='3lsqM'><fieldset id='3lsqM'></fieldset></dl></div>

  • <legend id='3lsqM'><style id='3lsqM'><dir id='3lsqM'><q id='3lsqM'></q></dir></style></legend>
      • <bdo id='3lsqM'></bdo><ul id='3lsqM'></ul>

        在 Postman 中将多级响应对象可视化为表

        Visualize multi-level response object as Table in Postman(在 Postman 中将多级响应对象可视化为表)

          1. <small id='UTIpy'></small><noframes id='UTIpy'>

            • <bdo id='UTIpy'></bdo><ul id='UTIpy'></ul>
              <i id='UTIpy'><tr id='UTIpy'><dt id='UTIpy'><q id='UTIpy'><span id='UTIpy'><b id='UTIpy'><form id='UTIpy'><ins id='UTIpy'></ins><ul id='UTIpy'></ul><sub id='UTIpy'></sub></form><legend id='UTIpy'></legend><bdo id='UTIpy'><pre id='UTIpy'><center id='UTIpy'></center></pre></bdo></b><th id='UTIpy'></th></span></q></dt></tr></i><div id='UTIpy'><tfoot id='UTIpy'></tfoot><dl id='UTIpy'><fieldset id='UTIpy'></fieldset></dl></div>
                <tbody id='UTIpy'></tbody>
              <tfoot id='UTIpy'></tfoot>
                <legend id='UTIpy'><style id='UTIpy'><dir id='UTIpy'><q id='UTIpy'></q></dir></style></legend>
                  本文介绍了在 Postman 中将多级响应对象可视化为表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想将 Postman 测试中的以下数据可视化为一个表格,其中列中有 productpricequantity行中的项目.可能有多个 shippingGroups.

                  I would like to visualize the data below in Postman Tests as a Table with product, price and quantity in columns and Items in rows. There might be multiple shippingGroups.

                  {
                     ...
                     "companyGroups": [
                          {
                              ...
                              "shippingGroups": [
                                  {
                                      "id": 1,
                                      "items": [
                                          {
                                              "product": "Product A",
                                              "price": 2,
                                              "quantity": 1,
                                          },
                                            {
                                              "product": "Product B",
                                              "price": 4,
                                              "quantity": 4,
                                          }
                  
                                      ],
                                      ...
                              ]
                          }
                      ],
                  

                  我在使用 {{#each response???}} 引用多个级别对象中的项目时遇到问题.预期的格式应该是这样的:

                  I have trouble using the {{#each response???}} referring to items within multiple level objects. Expected format should be something like :

                     <table>
                          <tr>
                              <th>Product</th>
                              <th>Price</th>
                              <th>Quantity</th>
                          </tr>
                  
                          {{#each response???}}
                              <tr>
                                  <td>{{???product}}</td>
                                  <td>{{???price}}</td>
                                  <td>{{???quantity}}
                              </tr>
                          {{/each}}
                      </table>
                  

                  有关邮递员表可视化响应的更多信息此处

                  More info on Postman Table Visualizing Response here

                  推荐答案

                  鉴于您的响应示例,您可以使用如下内容:

                  Given your response example, you could use something like this:

                  const template = `
                     <table>
                          <tr>
                              <th>Product</th>
                              <th>Price</th>
                              <th>Quantity</th>
                          </tr>
                  
                          {{#each responseData}}
                          {{#each items}}
                              <tr>
                                  <td>{{product}}</td>
                                  <td>{{price}}</td>
                                  <td>{{quantity}}
                              </tr>
                          {{/each}}
                          {{/each}}
                      </table>
                  `;
                  
                  let responseData = []
                  
                  _.each(pm.response.json().companyGroups, (item) => {
                      _.each(item.shippingGroups, (nestedItem) => {
                          responseData.push(nestedItem)
                      })
                  })
                  
                  pm.visualizer.set(template, { responseData })
                  

                  这只是一个粗略的示例,需要重构,但它表明您可以在表格中显示响应数据.

                  This is just a rough example and would need to be refactored but it shows that you can show the response data in the table.

                  这篇关于在 Postman 中将多级响应对象可视化为表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  keeping radio buttons checked after form submit(表单提交后保持选中单选按钮)
                  Bootstrap radio button quot;checkedquot; flag(Bootstrap 单选按钮“已选中旗帜)
                  Toggle HTML radio button by clicking its label(通过单击标签来切换 HTML 单选按钮)
                  Javascript how to change radio button label text?(Javascript如何更改单选按钮标签文本?)
                  JavaScript radio button confirmation(JavaScript 单选按钮确认)
                  How can I automatically select specific radio buttons with Greasemonkey?(如何使用 Greasemonkey 自动选择特定的单选按钮?)

                        <bdo id='sBvRu'></bdo><ul id='sBvRu'></ul>

                      • <i id='sBvRu'><tr id='sBvRu'><dt id='sBvRu'><q id='sBvRu'><span id='sBvRu'><b id='sBvRu'><form id='sBvRu'><ins id='sBvRu'></ins><ul id='sBvRu'></ul><sub id='sBvRu'></sub></form><legend id='sBvRu'></legend><bdo id='sBvRu'><pre id='sBvRu'><center id='sBvRu'></center></pre></bdo></b><th id='sBvRu'></th></span></q></dt></tr></i><div id='sBvRu'><tfoot id='sBvRu'></tfoot><dl id='sBvRu'><fieldset id='sBvRu'></fieldset></dl></div>

                        <small id='sBvRu'></small><noframes id='sBvRu'>

                          <tbody id='sBvRu'></tbody>

                        1. <legend id='sBvRu'><style id='sBvRu'><dir id='sBvRu'><q id='sBvRu'></q></dir></style></legend>
                          <tfoot id='sBvRu'></tfoot>