创建一个将使用jsonPath和类型的typeValidation,这应检查路径是否为相同类型

时间:2019-06-06 04:36:18

标签: java json validation

创建一个将使用jsonPath和类型的typeValidation,这应检查路径是否为相同类型?

validateByType(jsonString,pathString,typeString) validateByValue(jsonString,pathString,valueString)

实施将使用jayway Jsonpath验证来获取给定路径的值,然后我们必须查找其是否相同

{
    "store": {
        "book": [
            {
                "category": "reference",
                "author": "Nigel Rees",
                "title": "Sayings of the Century",
                "price": 8.95
            },
            {
                "category": "fiction",
                "author": "Evelyn Waugh",
                "title": "Sword of Honour",
                "price": 12.99
            },
            {
                "category": "fiction",
                "author": "Herman Melville",
                "title": "Moby Dick",
                "isbn": "0-553-21311-3",
                "price": 8.99
            },
            {
                "category": "fiction",
                "author": "J. R. R. Tolkien",
                "title": "The Lord of the Rings",
                "isbn": "0-395-19395-8",
                "price": 22.99
            }
        ],
        "bicycle": {
            "color": "red",
            "price": 19.95
        }
    },
    "expensive": 10
}

我需要validateByType(jsonString,pathString,typeString) 通过使用上面的Json代码进行validateByValue(jsonString,pathString,valueString)?

您能帮我吗? 在此先感谢...

0 个答案:

没有答案