我正在使用放心的 java,并且我正在使用发布请求来获得响应。从我的代码中,我能够得到响应,并且我看到作为响应,我看到我想要存储的值存在于键集中。这是示例:
{
"status_code": 200,
"status_message": "OK",
"response": {
"applications": {
"345": "A",
"125": "B",
"458": "C",
"434": "D",
"512": "E",
"645": "F"
}
}
}
在上面的示例中,我使用 Json 路径来解析表达式,并且我想使用值“A”从中提取键(“345”)。
JsonPath js = new JsonPath(res);
String Key = js.get("response.applications.A");
当我使用上面的代码时,它会抛出一个错误,但是当我运行下面的代码时。
JsonPath js = new JsonPath(res);
String Key = js.get("response.applications.345");
我得到的输出是 A。我知道 [A,b,c,d,e,f] 是什么,但我不知道 [A,b,c,d,e,f] 的键是什么
有什么方法可以存储该值并以放心的方式打印该值的密钥或在Java中以任何其他方式打印??????