从JsonPath获取匹配多个条件的字符串值

时间:2019-11-02 05:11:00

标签: rest-assured jsonpath rest-assured-jsonpath

jsonArray = "[{
        "id": "12",
        "Area": "Room",
        "Type": "Small",
        "mode": "Work",
    }, {
        "id": "243",
        "Area": "Hall",
        "Type": "Large",
        "mode": "Living",
    }, {
        "id": "561",
        "Area": "Kitchen",
        "Type": "Medium",
        "mode": "Cooking",
    }
]"

JsonPath ConfigPath = new JsonPath(jsonArray);

ConfigPath.get("d.findAll {d -> d.Area=='Room' && d -> d.Type=='Small'}.id");

如何获取同时符合两个条件的id的值?

我正在使用com.jayway.restassured.path.json.JsonPath

1 个答案:

答案 0 :(得分:0)

select a.title, b.type from ads a
inner join ads_infos b on a.title like concat('%', b.type, '%')
inner join ads_infos b on a.description like concat('%', b.type, '%')
where a.id='1'