简体   繁体   中英

How to extract json Responce using json path extractor?

I have below JSON response:

[
    {
        "CoID":"123",
        "OfflineStatus":"12",
        "PeriodID":"212",
        "ReportDate":"2\/6\/2015 12:00:00 AM",
        "TemplateID":"2114"
    },
    {
        "CoID":"21",
        "OfflineStatus":"11",
        "PeriodID":"3073",
        "ReportDate":"4\/30\/2015 12:00:00 AM",
        "TemplateID":"385155"
    }
]

I want to get Period is:3073, I tried $..[-1:] here I am getting all the things like coid, offlinestatus, periodid, reportdate, etc.

How to get only PeriodID ?

Just use :

$..PeriodID

And Match Number set to 2

See:

在此输入图像描述

使用JSON提取器尝试以下代码

$.[1].PeriodID

FOund Solution: Below Code worked for me. $.[-1:].PeriodID

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM