第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在 Postman 中將多級響應對象可視化為 Table

在 Postman 中將多級響應對象可視化為 Table

收到一只叮咚 2023-12-25 16:52:51
我想將郵遞員測試中的以下數據可視化為帶有product、price和quantity的列和Items行的表格??赡苡卸鄠€ ShippingGroups。{? ?...? ?"companyGroups": [? ? ? ? {? ? ? ? ? ? ...? ? ? ? ? ? "shippingGroups": [? ? ? ? ? ? ? ? {? ? ? ? ? ? ? ? ? ? "id": 1,? ? ? ? ? ? ? ? ? ? "items": [? ? ? ? ? ? ? ? ? ? ? ? {? ? ? ? ? ? ? ? ? ? ? ? ? ? "product": "Product A",? ? ? ? ? ? ? ? ? ? ? ? ? ? "price": 2,? ? ? ? ? ? ? ? ? ? ? ? ? ? "quantity": 1,? ? ? ? ? ? ? ? ? ? ? ? },? ? ? ? ? ? ? ? ? ? ? ? ? {? ? ? ? ? ? ? ? ? ? ? ? ? ? "product": "Product B",? ? ? ? ? ? ? ? ? ? ? ? ? ? "price": 4,? ? ? ? ? ? ? ? ? ? ? ? ? ? "quantity": 4,? ? ? ? ? ? ? ? ? ? ? ? }? ? ? ? ? ? ? ? ? ? ],? ? ? ? ? ? ? ? ? ? ...? ? ? ? ? ? ]? ? ? ? }? ? ],{{#each response???}}我在引用多個級別對象中的項目時遇到問題。預期的格式應該類似于:? ?<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>
查看完整描述

1 回答

?
DIEA

TA貢獻1820條經驗 獲得超2個贊

鑒于您的響應示例,您可以使用如下內容:


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 })

這只是一個粗略的示例,需要重構,但它表明您可以在表中顯示響應數據。


查看完整回答
反對 回復 2023-12-25
  • 1 回答
  • 0 關注
  • 176 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號