Write JSON to a File

后端 未结 4 2029
南旧
南旧 2020-12-31 16:34

I have a class compositionJSON. The class has a method calls makeJSONObject, that creates a JSON-Object and put stuff in it. Here is the code of the class.

p         


        
4条回答
  •  情书的邮戳
    2020-12-31 17:08

    In the method makeJSONObject you instantiate a new JSONObject.

    this code should work.

    public void makeJSONObject (String title, String desc, ArrayList imgPath, ArrayList imgView) {
    
        try {
            this.put("title", title);
            this.put("desc", desc);
            this.put("imgPath", imgPath);
            this.put("imgViewPath", imgView);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    

提交回复
热议问题