gpt4 book ai didi

java - 使用 MOXy 整理嵌套数组

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:26:42 24 4
gpt4 key购买 nike


我正在使用 JAXB 和 MOXy 来解码结构,例如

"coordinates": [
[
[
-5.9105761,
54.6850694
],
[
-5.6877263,
54.6850694
]
]
]

通常,当我面对json数组时,我只是使用这样的代码

Integer[] coordinate;
@XmlElement(name = "coordinate")
public Integer[] getCoordinate(){
return coordinate;
}
public void setCoordinate...

并且有效。因此,对于该结构,我想使用类似的代码

Float[][][] coordinates;
@XmlElement(name = "coordinates")
public Float[][][] getCoordinates(){...

但是在解码期间 MOXy 会抛出 NPE。你能告诉我,这种方法有什么问题吗?
此致,米哈伊尔。

最佳答案

目前 MOXy 不支持多维 JSON 数组。您可以使用以下增强请求来跟踪此功能:

关于java - 使用 MOXy 整理嵌套数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20284238/

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