Converts this object to JSON.

@return the JSON representation

@throws JSONException if JSON operations fail
968538
public JSONObject toJson() throws JSONException {

        JSONObject result = new JSONObject();
        if (m_detailId != null) {
            result.put(JSON_DETAIL, "" + m_detailId);
        }
        if (m_siteRoot != null) {
            result.put(JSON_SITEROOT, m_siteRoot);
        }
        if (m_structureId != null) {
            result.put(JSON_STRUCTUREID, "" + m_structureId);
        }
        if (m_projectId != null) {
            result.put(JSON_PROJECT, "" + m_projectId);
        }
        if (m_type != null) {
            result.put(JSON_TYPE, "" + m_type.getJsonId());
        }
        return result;
    }
1222177
public String toJson() throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        ByteArrayOutputStream out = new ByteArrayOutputStream();

        mapper.writeValue(out, this);
        return out.toString();
    }
482938
public ObjectNode toJson() {
		ObjectMapper mapper = new ObjectMapper();
		ObjectNode node = mapper.createObjectNode();
		ObjectNode attributeNode = mapper.createObjectNode();

		node.put(attribute.getCode(), attributeNode);
		attributeNode.put("op", operation.getOp());

		return node;
	}
212430
public JSONObject toJSON() {
        try {
            return new JSONObject(properties).putOpt("name", getName());
        } catch (JSONException e) {
            e.printStackTrace();
            Log.e(TAG, e, "toJSON()");
            throw new RuntimeAssertion("NodeEntry.toJSON() failed for '%s'", this);
        }
    }
1089724
public JSONWriter object() {
        if (this.mode == INIT) {
            this.mode = OBJECT;
        }
        if (this.mode == OBJECT || this.mode == ARRAY) {
            this.append("{");
            this.push(KEY);
            this.comma = false;
            return this;
        }
        throw new JSONException("Misplaced object: expected mode of INIT, OBJECT or ARRAY but was " + this.mode);

    }
456150
public JsonNode toJson() {
		ObjectNode node = new ObjectMapper().createObjectNode();
		node.put("code", code);
		if (format != null) {
			node.put("format", format);
		}
		return node;
	}
1069013
public JSONObject toJson() throws IOException {
    String base64 = new Zip().zip(getDirectory());
    Map<String, String> map = ImmutableMap.of(
      "className", this.getClass().getName(),
      BASE64_JSON_KEY, base64);
    
    return new JSONObject(map);
  }
904652
public String toJSON() {
        JSONEmitter json = new JSONEmitter();
        json.startDocument();
        toJSON(json);
        json.endDocument();
        return json.toString();
    }
16410
public JSONObject getJson() throws JSONException {
        JSONObject json = create();
        json.put("processInstance", processInstance.getJson());
        if (!children.isEmpty()) {
            JSONArray childrenArr = new JSONArray();
            for (LinkedProcessInstance child : children) {
                childrenArr.put(child.getJson());
            }
            json.put("children", childrenArr);
        }
        return json;
    }
229825
public JSONObject toJson() {
        JSONObject ret = new JSONObject();
        JSONArray columns = new JSONArray(Arrays.asList(new String[]{"time"}));
        for (String f : this.columns) {
            columns.put(f);
        }
        ret.put(KEY_COLUMNS, columns);

        JSONArray data = new JSONArray();
        ret.put(KEY_ROWS, data);
        for (Long ts : rows.keySet()) {
            JSONArray row = new JSONArray();
            row.put(ts);
            Map<String, Object> temp = rows.get(ts);
            for (String f : this.columns) {
                Object val = temp.get(f);
                row.put(val != null ? val : JSONObject.NULL);
            }
            data.put(row);
        }

        return ret;
    }
1117300
public String toJson() {
        logger.entering();

        parseResults();

        Gson gson = new GsonBuilder().setPrettyPrinting().create();
        String json = gson.toJson(this);
        logger.exiting(json);
        return json;
    }
549863
private Object readJSON() throws JSONException {
        switch (read(3)) {
        case zipObject:
            return readObject();
        case zipArrayString:
            return readArray(true);
        case zipArrayValue:
            return readArray(false);
        case zipEmptyObject:
            return new JSONObject();
        case zipEmptyArray:
            return new JSONArray();
        case zipTrue:
            return Boolean.TRUE;
        case zipFalse:
            return Boolean.FALSE;
        default:
            return JSONObject.NULL;
        }
    }
1181149
@Override
    public String toJSONString()
    {
        final JSONObject object = toJSONObject();

        if (null != object)
        {
            return object.toString();
        }
        return null;
    }
10863
public JsonNode toJsonArray() {
		ArrayNode node = new ObjectMapper().createArrayNode();
		for (String value : getAll()) {
			node.add(value);
		}
		return node;
	}
26893
public JSONObject toJson() {

        try {
            JSONObject result = new JSONObject();
            if (null != getStart()) {
                result.put(JsonKey.START, dateToJson(getStart()));
            }
            if (null != getEnd()) {
                result.put(JsonKey.END, dateToJson(getEnd()));
            }
            if (isWholeDay()) {
                result.put(JsonKey.WHOLE_DAY, true);
            }
            JSONObject pattern = patternToJson();
            result.put(JsonKey.PATTERN, pattern);
            SortedSet<Date> exceptions = getExceptions();
            if (!exceptions.isEmpty()) {
                result.put(JsonKey.EXCEPTIONS, datesToJson(exceptions));
            }
            switch (getEndType()) {
                case DATE:
                    result.put(JsonKey.SERIES_ENDDATE, dateToJson(getSeriesEndDate()));
                    break;
                case TIMES:
                    result.put(JsonKey.SERIES_OCCURRENCES, String.valueOf(getOccurrences()));
                    break;
                case SINGLE:
                default:
                    break;
            }
            if (!isCurrentTillEnd()) {
                result.put(JsonKey.CURRENT_TILL_END, false);
            }
            if (null != getParentSeriesId()) {
                result.put(JsonKey.PARENT_SERIES, getParentSeriesId().getStringValue());
            }
            return result;
        } catch (JSONException e) {
            LOG.error("Could not convert Serial date value to JSON.", e);
            return null;
        }
    }
894736
@Override
	public String toFormatJson(Object obj) {
		if (obj == null) {
			return null;
		}
		try {
			return writer.writeValueAsString(obj);
		}
		catch (Exception e) {
			throw new JsonException(e.getMessage(), e);
		}

	}
1033219
public JSONObject toJSON() {
        JSONObject ret = super.toJSON();
        if (arguments != null && arguments.size() > 0) {
            ret.put("arguments", arguments);
        }
        ret.put("operation", operation);
        return ret;
    }