我试图使用com.jayway.jsonpath.JsonPath从JSON字符串读取键/值:
String contentAsString = mvcResult.getResponse().getContentAsString();
System.out.println(contentAsString);
Object value = JsonPath.read(contentAsString, "$.key");
但我知道错误是:
Expected to find an object with property ['key'] in path $ but
"app":{
"icon":{
"icon":"TOP_RATED"
},
"message":{
"_type":"TextSpan",
"text":"Top Rated"
}
}
我一直在继承的一个项目中看到以下代码。上面的JSON响应被解析如下
// itemObject has the entire json response
// appObject is a POJO with
我正在编写一个AWS步骤函数,对于其中一个步骤,我希望调用一个lambda,它接受一个数组作为输入之一。但是,如果我尝试将一个JsonPath传入数组,我会得到
The value for the field 'arrayField.$' must be a STRING that contains a JSONPath but was an ARRAY
我的步骤函数定义:
{
"StartAt": "First",
"States": {
"First": {
"Type":