Code example for JSONObject

0
     
    public ImportingJob(long id, File dir) {
        this.id = id;
        this.dir = dir;
 
        JSONObject cfg = new JSONObject();
        JSONUtilities.safePut(cfg, "state", "new");
        JSONUtilities.safePut(cfg, "hasData", false);
        this.config = cfg;
         
        dir.mkdirs();
    } 
     
     
    public JSONObject getOrCreateDefaultConfig() {
        return config;
    } 
     
    public void setState(String state) {
        synchronized(config) {
            JSONUtilities.safePut(config, "state", state);