public JSONObject toJSONObject() { JSONObject jsonObject=new JSONObject(); SetsubSet=getFaqSubSet()==null?new HashSet<>():getFaqSubSet(); JSONArray array=new JSONArray(); Iterator it = subSet.iterator(); while (it.hasNext()) { FaqSub faqSub=it.next(); array.add(faqSub.toJSONObject()); } jsonObject.put("id", CommonSugar.getTypedDefault(getId(),0L)); jsonObject.put("title",CommonSugar.getTypedDefault(getTitle(),"")); jsonObject.put("set",CommonSugar.getTypedDefault(array,"")); return jsonObject; }