我有以下JSON文本,我需要解析以获取我的Android应用程序标题(主标题)和标题(子标题),description,imageHref。
{
"title":"Flowers",
"rows":[
{
"title":"Azalea",
"description":"Beautiful large royal purple flowers adorn attractive satiny green leaves that turn orange/red in cold weather. Grows to up to 18 feet, or prune annually to shorten.",
"imageHref":"http://...../../b/california_snow.jpg"
},
{
"title":"Tibouchina",
"description":"Blooms in summer, 20-35 inches high. Fertilize regularly for best results. Full sun, drought tolerant.",
"imageHref":"http://...../../b/california_snow.jpg"
}
}
请帮助我获取所需的代码。我正在使用JSONparser。
答案 0 :(得分:0)
尝试使用
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
GsonBuilder gsonBuilder = new GsonBuilder();
Gson gson=gsonBuilder.create();
gson.fromJson(<return type>,<expected type>);