【发布时间】:2019-09-12 10:48:43
【问题描述】:
请帮我解决这个问题。
看下面这个例子,我想在列表视图中获取这些数据。我们该怎么做?
{"Afpak":{"id":1,"race":"hybrid","flavors":["Earthy","Chemical","Pine"],"effects":{"positive":["Relaxed","Hungry","Happy","Sleepy"],"negative":["Dizzy"],"medical":["Depression","Insomnia","Pain","Stress","Lack of Appetite"]}},"African":{"id":2,"race":"sativa","flavors":["Spicy/Herbal","Pungent","Earthy"],"effects":{"positive":["Euphoric","Happy","Creative","Energetic","Talkative"],"negative":["Dry Mouth"],"medical":["Depression","Pain","Stress","Lack of Appetite","Nausea","Headache"]}}}
【问题讨论】:
-
你有没有尝试过?
-
检查这个库:github.com/google/gson 你可以用它来解析 json 到 java 对象。