Serialize a FedoraEvent into a JSON String
@param evt the Fedora event
@return a JSON string
778007
@Override
    public String serialize(final FedoraEvent evt) {
        try {
            return MAPPER.writeValueAsString(from(evt));
        } catch (final JsonProcessingException ex) {
            LOGGER.error("Error processing JSON: {}", ex.getMessage());
            return null;
        }
    }
513193
public static String toJsonString(Collection<Attribute> attributeCollection, ObjectMapper objectMapper) throws JsonProcessingException {
        return objectMapper.writeValueAsString(toObject(attributeCollection));
    }
191015
public String format(LoggingEvent event) {
        JsonObject jsonEvent = new JsonObject();
        jsonEvent.addProperty("v", 0);
        jsonEvent.addProperty("level", BUNYAN_LEVEL.get(event.getLevel()));
        jsonEvent.addProperty("name", event.getLoggerName());
        try {
            jsonEvent.addProperty("hostname", InetAddress.getLocalHost().getHostName());
        } catch (UnknownHostException e) {
            jsonEvent.addProperty("hostname", "unkown");
        }
        jsonEvent.addProperty("pid", getThreadId(event));
        jsonEvent.addProperty("time", formatAsIsoUTCDateTime(event.getTimeStamp()));
        jsonEvent.addProperty("msg", event.getMessage().toString());

        if (event.getLevel().isGreaterOrEqual(Level.ERROR) && event.getThrowableInformation() != null) {
            JsonObject jsonError = new JsonObject();
            Throwable e = event.getThrowableInformation().getThrowable();

            jsonError.addProperty("message", e.getMessage());
            jsonError.addProperty("name", e.getClass().getSimpleName());

            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            jsonError.addProperty("stack", sw.toString());
            jsonEvent.add("err", jsonError);
        }
        return GSON.toJson(jsonEvent) + "\n";
    }
1032081
function returnJSON(finalResp, res) {
    if (JSONformat === 'JSON') {
      res.set('Content-Type', `application/json; charset=${encoding}`);
      res.json(finalResp);
    } else {
      res.set('Content-Type', `text/plain; charset=${encoding}`);
      res.send(JSON.stringify(finalResp));
    }
  }
588066
public String toJson() {
      try {
         Resource stringResource = Resources.fromString();
         write(stringResource);
         return stringResource.readToString().trim();
      } catch (IOException e) {
         throw Throwables.propagate(e);
      }
   }
525396
public static String toJson(HppResponse hppResponse) {
		try {
			return hppResponseWriter.writeValueAsString(hppResponse);
		} catch (JsonProcessingException ex) {
			LOGGER.error("Error writing HppResponse to JSON.", ex);
			throw new RealexException("Error writing HppResponse to JSON.", ex);
		}
	}
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);
        }
    }
1004265
@Subscribe
    public void publishJCREvent(final FedoraEvent fedoraEvent) throws JMSException {
        LOGGER.debug("Received an event from the internal bus.");
        final Message tm =
                eventFactory.getMessage(fedoraEvent, jmsSession);
        LOGGER.debug("Transformed the event to a JMS message.");
        producer.send(tm);

        LOGGER.debug("Put event: {} onto JMS.", tm.getJMSMessageID());
    }
1322251
public String toJson() {
		StringBuilder json = new StringBuilder("");
		json.append("{");
		json.append("\"vertexid\": \"" + this.getID() + "\",");
		json.append("\"vertexname\": \"" + StringUtils.escapeHtml(this.toString()) + "\",");
		json.append("\"vertexstatus\": \"" + this.getExecutionState() + "\",");
		json.append("\"vertexinstancename\": \"" + this.getInstanceName() + "\",");
		json.append("\"vertexinstancetype\": \"" + this.getInstanceType() + "\"");
		json.append("}");
		return json.toString();
	}
1159235
def format_json(event, colored):
        

        try:
            if event.message.startswith("{"):
                msg_dict = json.loads(event.message)
                event.message = json.dumps(msg_dict, indent=2)
        except Exception:
            # Skip if the event message was not JSON
            pass

        return event
622268
public JSONObject getJson() throws JSONException {
        JSONObject json = create();
        json.put("id", getLogicalId());
        json.put("to", "A" + toId);
        if (completionCode != null)
            json.put("resultCode", completionCode);
        if (eventType != null)
            json.put("event", EventType.getEventTypeName(eventType));
        if (attributes != null && ! attributes.isEmpty())
            json.put("attributes", Attribute.getAttributesJson(attributes));
        return json;
    }
611202
public final static String toJSON(HELM2Notation helm2notation) throws JsonProcessingException {
    ObjectMapper mapper = new ObjectMapper();
    String jsonINString = mapper.writeValueAsString(helm2notation);
    jsonINString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(helm2notation);
    return jsonINString;
  }
648850
private static JsonStructure toJson( FunctionInputDef functionInput)
    {
    JsonObjectBuilder builder = Json.createObjectBuilder();

    addAnnotations( builder, functionInput);

    Arrays.stream( functionInput.getVarTypes()).forEach( varType -> builder.add( varType, toJson( functionInput, varType)));

    return builder.build();
    }
676383
public static String toJson(CouchbaseEvent source, boolean pretty) {
        try {
            if (pretty) {
                return DefaultObjectMapper.prettyWriter().writeValueAsString(source.toMap());
            } else {
                return DefaultObjectMapper.writeValueAsString(source.toMap());
            }
        } catch (JsonProcessingException e) {
            throw new CouchbaseException("Could not convert CouchbaseEvent " + source.toString() + " to JSON: ", e);
        }
    }
781703
def serialize(self, content):
        
        content = super(JSONPTemplateEmitter, self).serialize(content)
        callback = self.request.GET.get('callback', 'callback')
        return '%s(%s)' % (callback, content)
926753
public String toJSON(boolean bPretty) {
        int indent = bPretty ? 3 : 0;
        JSONEmitter json = new JSONEmitter(indent);
        json.startDocument();
        toJSON(json);
        json.endDocument();
        return json.toString();
    }
146791
public String toJSONString() {
    return JSON.toJSONString(this, ObjectValueFilter.instance,
          SerializerFeature.WriteClassName,
          SerializerFeature.DisableCircularReferenceDetect);
  }