作者:战冰_斗雪 | 来源:互联网 | 2023-05-18 16:01
IhaveaJsonObjectnamedmappingwiththefollowingcontent:我有一个名为“mapping”的JsonObject,内容如下:{
I have a JsonObject
named "mapping"
with the following content:
我有一个名为“mapping”的JsonObject,内容如下:
{
"client": "127.0.0.1",
"servers": [
"8.8.8.8",
"8.8.4.4",
"156.154.70.1",
"156.154.71.1"
]
}
I know I can get the array "servers"
with:
我知道我可以用:
mapping.get("servers").getAsJsonArray()
And now I want to parse that JsonArray
into a java.util.List
...
现在我要把这个JsonArray解析为java.util.List…
What is the easiest way to do this?
最简单的方法是什么?
5 个解决方案