How to get JSON object from array of JSON objects in postman?

烂漫一生 提交于 2019-12-13 20:08:03

问题


Looked for while on other threads and questions didn't get how to get JSON object in array questions I have already looked at - How to get JSONobject from JSONArray in postman
How to get array from JSON Object?

what I have tried so far -

var jsonData = JSON.parse(responseBody);
var jsonObject = jsonData.events[2];
console.log("jsonobject - " + jsonObject);

console output -

jsonobject - [object Object]

json response looks like this -

[
 {

        "$ts": "2019-06-14T06:21:55.2221392Z",
        "values": [
            "43912",
            "CountIn",
            "neet.row.mac3.indexinput",
            "mac3",
            "mac3",
            "mac3",
            300,
            11,
            1,
            "mac3",
            "2019-06-14T06:21:55.2221392Z",
            "2019-06-14T06:22:55.2221392Z",
            "manager",
            "lead",
            "consultant",
            "5ca1e66d7eb20a11f00e502c
        ]
    },
    {

        "$ts": "2019-06-14T06:23:54.3263475Z",
        "values": [
            "44272",
            "indexinput",
            "neet.row.mac2.indexinput",
            "mac2",
            "mac2",
            "mac2",
            300,
            11,
            1,
            "mac2",
            "2019-06-14",
            "2019-06-14",
            "Head",
            "Master",
            "Student",
            "5ca1e66d7eb20a11f00e502c"
        ]
    },
    {
        "$ts": "2019-06-14T06:24:54.3753534Z",
        "values": [
            "44452",
            "indexinput",
            "neet.row.mac.indexinput",
            "mac",
            "mac",
            "mac",
            300,
            11,
            1,
            "Neet",
            "2019-06-14T06:24:54.3753534Z",
            "something1",
            "something2 of something1",
            "something3 of something2 ",
            "5ca1e66d7eb20a11f00e502c"

        ]
    }
]

来源:https://stackoverflow.com/questions/56838487/how-to-get-json-object-from-array-of-json-objects-in-postman

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