第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

將 json 數(shù)組轉(zhuǎn)換為 POJO?

將 json 數(shù)組轉(zhuǎn)換為 POJO?

縹緲止盈 2021-10-20 16:29:41
以下是json對(duì)象的數(shù)組[  {    "name": " hh",    "place": "usa",    "isPres": false,    "id": {      "lId": {        "id1": "40",        "level1": "tte"      },      "space": "ua"    },    "isempty": null,    "isspace": true  },  {    "name": " GE",    "place": "guinea",    "isPres": true,    "id": {      "lId": {        "id1": "30",        "level1": "Le"      },      "space": "ma"    },    "isempty": null,    "isspace": false  }]我嘗試了以下代碼將 JSON 數(shù)組轉(zhuǎn)換為 POJO公共類 JsonToPojo { public static void main(String[] args) {        String packageName="com.vogella.maven.quickstart";        File inputJson= new File("C:/projects/quickstart/input.json");        File outputPojoDirectory=new File("."+File.separator+"convertedPojo");        outputPojoDirectory.mkdirs();        try {             new JsonToPojo().convert2JSON(inputJson.toURI().toURL(), outputPojoDirectory, packageName, inputJson.getName().replace(".json", ""));        } catch (IOException e) {             // TODO Auto-generated catch block             System.out.println("Encountered issue while converting to pojo: "+e.getMessage());             e.printStackTrace();        }   }   public void convert2JSON(URL inputJson, File outputPojoDirectory, String packageName, String className) throws IOException{        JCodeModel codeModel = new JCodeModel();        URL source = inputJson;        GenerationConfig config = new DefaultGenerationConfig() {        @Override        public boolean isGenerateBuilders() { // set config option by overriding method            return true;        }        public SourceType getSourceType(){    return SourceType.JSON;  }        };        SchemaMapper mapper = new SchemaMapper(new RuleFactory(config, new Jackson2Annotator(config), new SchemaStore()), new SchemaGenerator());        mapper.generate(codeModel, className, packageName, source);        codeModel.build(outputPojoDirectory);   }  }但問題是我只為數(shù)組的一個(gè)對(duì)象而不是為兩個(gè)對(duì)象獲取 java pojo 類我想要兩個(gè)數(shù)組的結(jié)果
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 199 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)