// create the JSON object and add common values
JSONObject jsonObj = new JSONObject();
jsonObj.accumulate("query", results.getQuery());
jsonObj.accumulate("lang", results.getLang());
jsonObj.accumulate("sort", results.getSort());
jsonObj.accumulate("reverse", results.isReverse());
jsonObj.accumulate("start", results.getStart());
jsonObj.accumulate("end", results.getEnd());
jsonObj.accumulate("rows", results.getRows());
jsonObj.accumulate("totalhits", results.getTotalHits());
jsonObj.accumulate("withSummary", results.isWithSummary());