fastjson官網(wǎng) 怎么使用fastJson來解析JSON格式數(shù)據(jù)和生成JSON格式數(shù)據(jù)?
怎么使用fastJson來解析JSON格式數(shù)據(jù)和生成JSON格式數(shù)據(jù)?首先,創(chuàng)建一個JSON解析類:public class jsonparser{private int devid public i
怎么使用fastJson來解析JSON格式數(shù)據(jù)和生成JSON格式數(shù)據(jù)?
首先,創(chuàng)建一個JSON解析類:public class jsonparser{private int devid public int getdevid(){return devid}public void setdevid(int devid){這個。德維德=Devid}創(chuàng)建需要解析的相應對象:String STR=“{”Devid“:12345}”jsonparser jsonstring=JSON.parseObject(strJsonParser.class類)str參數(shù)是要解析的字符串,然后調(diào)用object response=jsonString.getDevid() 系統(tǒng)輸出打?。╠evid)//12345 encode:還創(chuàng)建相應的JSON類(簡單啟動)