Android studio外掛GsonFormat的使用
阿新 • • 發佈:2019-02-04
第一步:安裝GsonFormat外掛
首先,開啟Android studio設定介面,快捷鍵command+逗號(mac上的快捷鍵),開啟Plugins點選Browse Respositories,然後搜尋GsonFormat,然後點選安裝,重啟Android Studio
2.建立JavaBean
按下快捷鍵command+n,然後選擇GsonFormat,把已經格式化好的json複製進來,點選OK就哦了!
3.給出一個相對複雜的json資料
{
"title":{
"name":"來米匯",
"time":"2016-12-16" ,
"info":{
"code":"0",
"message":"成功"
}
},
"content":{
"detail":[
{
"storename":"西二旗店",
"itemlist":[
{
"id":"1",
"productname":"蘋果"
},
{
"id":"2",
"productname":"香蕉"
},
{
"id":"3",
"productname":"橙子"
}
]
},
{
"storename ":"霍營店",
"itemlist":[
{
"id":"1",
"productname":"葡萄"
},
{
"id":"2",
"productname":"火龍果"
},
{
"id":"3",
"productname":"榴蓮"
}
]
},
{
"storename":"回龍觀店",
"itemlist":[
{
"id":"1",
"productname":"橘子"
},
{
"id":"2",
"productname":"黃瓜"
},
{
"id":"3",
"productname":"西紅柿"
}
]
}
]
}
}