gpt4 book ai didi

java - 如何从放心的 JsonPath 中获取 List

转载 作者:行者123 更新时间:2023-11-30 04:39:58 25 4
gpt4 key购买 nike

我正在使用放心框架,并且在它内部,它有 JsonPath 类。JsonPath 的方法签名为 getList(String path, Class T);

我尝试做这样的事情:

List<JsonPath> myList = myJsonPathObject.getList("mypath", JsonPath.class);

我收到运行时转换异常。那么调用它的正确格式是什么。我也尝试过:

List<JsonPath> myList = myJsonPathObject.getList("mypath", new ArrayList<JsonPath>().getClass());

这也失败了。实际上编译失败了。

最佳答案

JsonPath 用于从 JSON 文档中提取值。您无法从 JSON 文档中获取“JsonPath”列表。

关于java - 如何从放心的 JsonPath 中获取 List<JsonPath>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12537288/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com