Serializes this artwork object to a {@link JSONObject} representation.

@return the JSON representation of the artwork.

@throws JSONException if there is an error creating the JSON representation.
513143
@NonNull
    public JSONObject toJson() throws JSONException {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put(KEY_COMPONENT_NAME, (mComponentName != null) ? mComponentName.flattenToShortString() : null);
        jsonObject.put(KEY_IMAGE_URI, (mImageUri != null) ? mImageUri.toString() : null);
        jsonObject.put(KEY_TITLE, mTitle);
        jsonObject.put(KEY_BYLINE, mByline);
        jsonObject.put(KEY_ATTRIBUTION, mAttribution);
        jsonObject.put(KEY_TOKEN, mToken);
        jsonObject.put(KEY_VIEW_INTENT, (mViewIntent != null)
                ? mViewIntent.toUri(Intent.URI_INTENT_SCHEME) : null);
        jsonObject.put(KEY_META_FONT, mMetaFont);
        jsonObject.put(KEY_DATE_ADDED, mDateAdded != null ? mDateAdded.getTime() : 0);
        return jsonObject;
    }
1022659
@Override
	public String toJson(Object obj) {
		try {
			String json;
			if (obj == null) {
				json = null;
			}
			else {
				json = mapper.writeValueAsString(obj);
			}
			return json;
		}
		catch (Exception e) {
			throw new JsonException(e.getMessage(), e);
		}
	}
136734
public Result json() {
        setContentType(MimeTypes.JSON);
        charset = Charsets.UTF_8;
        // If we already have a String content, we must set the type.
        // The renderable object checks whether or not the given String is a valid JSON string,
        // or if a transformation is required.
        if (getRenderable() instanceof RenderableString) {
            ((RenderableString) getRenderable()).setType(MimeTypes.JSON);
        }
        return this;
    }
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;
    }
144200
@Override
    public JSONObject getJson() throws JSONException {
        JSONObject json = create();
        json.put("id", id);
        if (eventName != null)
            json.put("eventName", eventName);
        if (createDate != null) {
            json.put("createDate", createDate);
        }
        if (createUser != null) {
            json.put("createUser", createUser);
        }
        if (source != null) {
            json.put("source", source);
        }
        if (category != null) {
            json.put("category", category);
        }
        if (subCategory != null) {
            json.put("subCategory", subCategory);
        }
        if (ownerType != null) {
            json.put("ownerType", ownerType);
        }
        if (ownerId != null) {
            json.put("ownerId", ownerId);
        }
        if (comment != null) {
            json.put("comment", comment);
        }
        return json;
    }
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;
    }
776099
public JSONObject asJSONObject() throws TwitterException {
        if (json == null) {
            try {
                json = new JSONObject(asString());
                if (CONF.isPrettyDebugEnabled()) {
                    logger.debug(json.toString(1));
                } else {
                    logger.debug(responseAsString != null ? responseAsString :
                        json.toString());
                }
            } catch (JSONException jsone) {
                if (responseAsString == null) {
                    throw new TwitterException(jsone.getMessage(), jsone);
                } else {
                    throw new TwitterException(jsone.getMessage() + ":" + this.responseAsString, jsone);
                }
            } finally {
                disconnectForcibly();
            }
        }
        return json;
    }
904652
public String toJSON() {
        JSONEmitter json = new JSONEmitter();
        json.startDocument();
        toJSON(json);
        json.endDocument();
        return json.toString();
    }
1181149
@Override
    public String toJSONString()
    {
        final JSONObject object = toJSONObject();

        if (null != object)
        {
            return object.toString();
        }
        return null;
    }
135577
@Override
    public String toJSON() {
        final ObjectMapper mapper = buildObjectMapperForSerialization();
        try {
            return mapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
            throw new IllegalStateException("Object cannot be parsed as JSON.", e);
        }
    }
693063
public JSONObject asJSONObject()
    {
        if ( entity == null ) {
            return null;
        }
        String str = asString();
        try {
            return new JSONObject( str );
        } catch ( JSONException ex ) {
            throw new CStorageException( "Error parsing the JSON response: " + str, ex );
        }
    }
919026
@Override
    public String toJson() {
        try {
            return objectMapper.writeValueAsString(status());
        } catch (JsonProcessingException e) {
            throw new RuntimeException(e);
        }
    }
1187338
public String toJSONString() {
        if (context.isPretty()) {
            return JSON.toJSONStringWithDateFormat(this, Constant.DATE_SERIALIZE_FORMAT, SerializerFeature.PrettyFormat);
        } else {
            return JSONObject.toJSONStringWithDateFormat(this, Constant.DATE_SERIALIZE_FORMAT);
        }
    }
673601
public JsonObject toJson() {
    JsonObject body = new JsonObject();
    body.add(JsonRpcProtocol.ID, id());

    if (isError()) {
      body.add(JsonRpcProtocol.ERROR, error().toJson());
    } else {
      body.add(JsonRpcProtocol.RESULT, result());
    }
    return body;
  }
337810
public static JSONObject toJSONObject(java.util.Properties properties) throws JSONException {
        // can't use the new constructor for Android support
        // JSONObject jo = new JSONObject(properties == null ? 0 : properties.size());
        JSONObject jo = new JSONObject();
        if (properties != null && !properties.isEmpty()) {
            Enumeration<?> enumProperties = properties.propertyNames();
            while(enumProperties.hasMoreElements()) {
                String name = (String)enumProperties.nextElement();
                jo.put(name, properties.getProperty(name));
            }
        }
        return jo;
    }
381215
protected String getJSONReply(final Object _jsonObject)
    {
        String ret = "";
        final ObjectMapper mapper = new ObjectMapper();
        if (LOG.isDebugEnabled()) {
            mapper.enable(SerializationFeature.INDENT_OUTPUT);
        }
        mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
        mapper.registerModule(new JodaModule());
        try {
            ret =  mapper.writeValueAsString(_jsonObject);
        } catch (final JsonProcessingException e) {
            LOG.error("Catched JsonProcessingException", e);
        }
        return ret;
    }
588066
public String toJson() {
      try {
         Resource stringResource = Resources.fromString();
         write(stringResource);
         return stringResource.readToString().trim();
      } catch (IOException e) {
         throw Throwables.propagate(e);
      }
   }