Convert a JTS Envelope to a GeoJSON representation.

@param e The envelope

@return The envelope encoded as GeoJSON
175854
public String toGeoJsonEnvelope(Envelope e) {
        return new StringBuffer().append("[").append(e.getMinX()).append(",")
                .append(e.getMinY()).append(",").append(e.getMaxX()).append(",")
                .append(e.getMaxY()).append("]").toString();
    }
298279
@SuppressWarnings("unchecked")
	@Override
	public <E> String serialize(E object) {
		if (object == null)
			return null;

		SegmentedStringWriter source = new SegmentedStringWriter(buffer.get());
		try (SerializerWrapper serializer = createSerializer(source)) {
			mapperFor((Class<E>) object.getClass()).serialize(this, serializer, object);
		} catch (Exception e) {
			e.printStackTrace();
			throw new KriptonRuntimeException(e);
		}

		return source.getAndClear();

	}
1006831
@Override
  @SuppressWarnings("unused")
  public String toJson() {

    Gson gson = new GsonBuilder()
      .registerTypeAdapterFactory(GeometryAdapterFactory.create())
      .registerTypeAdapter(BoundingBox.class, new BoundingBoxTypeAdapter())
      .registerTypeAdapterFactory(GeocodingAdapterFactory.create())
      .create();

    // Empty properties -> should not appear in json string
    CarmenFeature feature = this;
    if (properties() != null && properties().size() == 0) {
      feature = toBuilder().properties(null).build();
    }

    return gson.toJson(feature, CarmenFeature.class);
  }
75664
public JsonObject toJsonObject() {
        JsonObjectBuilder factory = Json.createObjectBuilder();
        if (nym != null) {
            JsonObjectBuilder factory2 = Json.createObjectBuilder();
            factory2.add("x", Base64.getEncoder().encodeToString(IdemixUtils.bigToBytes(nym.getX())));
            factory2.add("y", Base64.getEncoder().encodeToString(IdemixUtils.bigToBytes(nym.getY())));
            factory.add("nym", factory2.build());
        }

        if (issuerNonce != null) {
            String b64encoded = Base64.getEncoder().encodeToString(IdemixUtils.bigToBytes(issuerNonce));
            factory.add("issuer_nonce", b64encoded);
        }

        if (proofC != null) {
            factory.add("proof_c", Base64.getEncoder().encodeToString(IdemixUtils.bigToBytes(proofC)));
        }

        if (proofS != null) {
            factory.add("proof_s", Base64.getEncoder().encodeToString(IdemixUtils.bigToBytes(proofS)));
        }

        return factory.build();
    }
1237731
def to_geojson(self, filename):
        """"""
        with open(filename, 'w') as fd:
            json.dump(self.to_record(WGS84_CRS), fd)
510192
public SourceMap toJSON() {
        SourceMap map = new SourceMap();
        map.version = this._version;
        map.sources = this._sources.toArray();
        map.names = this._names.toArray();
        map.mappings = serializeMappings();
        map.file = this._file;
        map.sourceRoot = this._sourceRoot;
        if (this._sourcesContents != null) {
            map.sourcesContent = _generateSourcesContent(map.sources, this._sourceRoot);
        }
        return map;
    }
278861
@JsonProperty("e")
    @JsonSerialize(using = Base64UrlJsonSerializer.class)
    @JsonDeserialize(using = Base64UrlJsonDeserializer.class)
    public byte[] e() {
        return ByteExtensions.clone(this.e);
    }
1037797
public static Polygon envelopeToPolygon( Envelope2D envelope ) {
        double w = envelope.getMinX();
        double e = envelope.getMaxX();
        double s = envelope.getMinY();
        double n = envelope.getMaxY();

        Coordinate[] coords = new Coordinate[5];
        coords[0] = new Coordinate(w, n);
        coords[1] = new Coordinate(e, n);
        coords[2] = new Coordinate(e, s);
        coords[3] = new Coordinate(w, s);
        coords[4] = new Coordinate(w, n);

        GeometryFactory gf = GeometryUtilities.gf();
        LinearRing linearRing = gf.createLinearRing(coords);
        Polygon polygon = gf.createPolygon(linearRing, null);
        return polygon;
    }
1284011
public String toJSONString(final boolean compact) {
        final StringBuilder builder = new StringBuilder();
        formatAsJSON(builder, 0, !compact);
        return builder.toString();
    }
351260
public static String toJson(Object obj) {
		try {
			return objectMapper.writeValueAsString(obj);
		} catch (JsonProcessingException e) {
			throw new RuntimeException(e);
		}
	}
1355059
@SuppressWarnings("unchecked")
    public static <E> String serialize(E object) throws IOException {
        return mapperFor((Class<E>)object.getClass()).serialize(object);
    }
1083534
public String toJson() {
		StringBuilder json = new StringBuilder("");
		
		json.append("{");
		json.append("\"groupvertexid\": \"" + this.getID() + "\",");
		json.append("\"groupvertexname\": \"" + StringUtils.escapeHtml(this.getName()) + "\",");
		json.append("\"numberofgroupmembers\": " + this.getNumberOfGroupMembers() + ",");
		json.append("\"groupmembers\": [");
		
		// Count state status of group members
		Map<ExecutionState, Integer> stateCounts = new HashMap<ExecutionState, Integer>();
		
		// initialize with 0
		for (ExecutionState state : ExecutionState.values()) {
			stateCounts.put(state, new Integer(0));
		}
		
		for(int j = 0; j < this.getNumberOfGroupMembers(); j++) {
			ManagementVertex vertex = this.getGroupMember(j);
			
			json.append(vertex.toJson());
			
			// print delimiter
			if(j != this.getNumberOfGroupMembers() - 1) {
				json.append(",");
			}
			
			// Increment state status count
			Integer count =  stateCounts.get(vertex.getExecutionState()) + new Integer(1);
			stateCounts.put(vertex.getExecutionState(), count);
		}
		json.append("],");
		json.append("\"backwardEdges\": [");
		
		for(int edgeIndex = 0; edgeIndex < this.getNumberOfBackwardEdges(); edgeIndex++) {
			ManagementGroupEdge edge = this.getBackwardEdge(edgeIndex);
			
			json.append("{");
			json.append("\"groupvertexid\": \"" + edge.getSource().getID() + "\",");
			json.append("\"groupvertexname\": \"" +  StringUtils.escapeHtml(edge.getSource().getName()) + "\",");
			json.append("\"channelType\": \"" +  edge.getChannelType() + "\"");
			json.append("}");
			
			// print delimiter
			if(edgeIndex != this.getNumberOfBackwardEdges() - 1) {
				json.append(",");
			}
		}
		json.append("]");
		
		// list number of members for each status
		for (Map.Entry<ExecutionState, Integer> stateCount : stateCounts.entrySet()) {
			json.append(",\""+stateCount.getKey()+"\": " + stateCount.getValue());
		}
		
		json.append("}");
		
		return json.toString();
	}
358656
public <T extends BullhornEntity> String convertEntityToJsonString(T entity) {
        String jsonString = "";
        try {
            jsonString = objectMapperStandard.writeValueAsString(entity);
        } catch (JsonProcessingException e) {
            log.error("Error deserializing entity of type" + entity.getClass() + " to jsonString.", e);
        }
        return jsonString;
    }
362708
private String dumpJavaColonCompEnvMap() {
        StringBuffer buffer = new StringBuffer("");
        buffer.append("EJBContext.lookup data structure contents:\n");
        buffer.append("   Contains **" + ivJavaColonCompEnvMap.size() + "** bindings.\n");
        if (!ivJavaColonCompEnvMap.isEmpty()) {
            Set<Map.Entry<String, InjectionBinding<?>>> entries = ivJavaColonCompEnvMap.entrySet();
            Iterator<Map.Entry<String, InjectionBinding<?>>> entryIterator = entries.iterator();
            int count = 0;
            while (entryIterator.hasNext()) {
                Map.Entry<String, InjectionBinding<?>> oneEntry = entryIterator.next();
                buffer.append("     Entry " + count + "\n");
                buffer.append("            Key: **" + oneEntry.getKey() + "**\n");
                buffer.append("            Value: **" + oneEntry.getValue() + "**\n");
                buffer.append("\n");
                count++;
            }
        }
        return buffer.toString();
    }
614190
@SuppressWarnings("unused")
  public String toJson() {
    Gson gson = new GsonBuilder()
      .registerTypeAdapterFactory(GeocodingAdapterFactory.create())
      .create();
    return gson.toJson(this);
  }
570512
private static Response createErrorResponse(S3Exception e) {
    S3Error errorResponse = new S3Error(e.getResource(), e.getErrorCode());
    // Need to explicitly encode the string as XML because Jackson will not do it automatically.
    XmlMapper mapper = new XmlMapper();
    try {
      return Response.status(e.getErrorCode().getStatus())
          .entity(mapper.writeValueAsString(errorResponse)).build();
    } catch (JsonProcessingException e2) {
      return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
          .entity("Failed to encode XML: " + e2.getMessage()).build();
    }
  }
1212774
@SuppressWarnings("unchecked")
    private void toJson(MarcRecord marcRecord, StringBuilder sb) {
        if (marcRecord.isEmpty()) {
            return;
        }
        if (top) {
            top = false;
            if (style == Style.ELASTICSEARCH_BULK) {
                writeMetaDataLine(marcRecord);
            }
        } else {
            switch (style) {
                case ARRAY:
                    sb.append(",");
                    break;
                case LINES:
                    sb.append("\n");
                    break;
                case ELASTICSEARCH_BULK:
                    sb.append("\n");
                    writeMetaDataLine(marcRecord);
                    break;
                default:
                    break;
            }
        }
        sb.append("{");
        int c0 = 0;
        for (Map.Entry<String, Object> tags : marcRecord.entrySet()) {
            if (c0 > 0) {
                sb.append(",");
            }
            String tag = tags.getKey();
            sb.append("\"").append(tag).append("\":");
            Object o = tags.getValue();
            if (o instanceof Map) {
                int c00 = 0;
                Map<String, Object> repeatMap = (Map<String, Object>) o;
                sb.append("[");
                for (Map.Entry<String, Object> repeats : repeatMap.entrySet()) {
                    if (c00 > 0) {
                        sb.append(",");
                    }
                    o = repeats.getValue();
                    if (!(o instanceof List)) {
                        o = Collections.singletonList(o);
                    }
                    List<?> list = (List<?>) o;
                    if (list.size() > 1) {
                        sb.append("[");
                    }
                    int c1 = 0;
                    for (Object value : list) {
                        if (c1 > 0) {
                            sb.append(",");
                        }
                        if (value instanceof Map) {
                            sb.append("{");
                            int c2 = 0;
                            for (Map.Entry<String, Object> indicators : ((Map<String, Object>) value).entrySet()) {
                                if (c2 > 0) {
                                    sb.append(",");
                                }
                                String indicator = indicators.getKey();
                                sb.append("\"").append(indicator).append("\":");
                                o = indicators.getValue();
                                if (!(o instanceof List)) {
                                    o = Collections.singletonList(o);
                                }
                                List<?> list2 = (List<?>) o;
                                sb.append("[");
                                int c3 = 0;
                                for (Object value2 : list2) {
                                    if (c3 > 0) {
                                        sb.append(",");
                                    }
                                    if (value2 instanceof Map) {
                                        Map<String, Object> map = (Map<String, Object>) value2;
                                        int c4 = 0;
                                        for (Map.Entry<String, Object> subfield : map.entrySet()) {
                                            if (c4 > 0) {
                                                sb.append(",");
                                            }
                                            sb.append("{");
                                            sb.append("\"").append(subfield.getKey()).append("\":");
                                            if (subfield.getValue() instanceof List) {
                                                sb.append("[");
                                                int c5 = 0;
                                                for (String s : (List<String>) subfield.getValue()) {
                                                    if (c5 > 0) {
                                                        sb.append(",");
                                                    }
                                                    sb.append("\"").append(escape(s)).append("\"");
                                                    c5++;
                                                }
                                                sb.append("]");
                                            } else {
                                                sb.append("\"").append(escape(subfield.getValue().toString())).append("\"");
                                            }
                                            c4++;
                                            sb.append("}");
                                        }
                                    } else {
                                        sb.append("\"").append(escape(value2.toString())).append("\"");
                                    }
                                    c3++;
                                }
                                sb.append("]");
                                c2++;
                            }
                            sb.append("}");
                        } else {
                            if (value == null) {
                                sb.append("null");
                            } else {
                                sb.append("\"").append(escape(value.toString())).append("\"");
                            }
                        }
                        c1++;
                    }
                    if (list.size() > 1) {
                        sb.append("]");
                    }
                    c00++;
                }
                sb.append("]");
            } else {
                if (o == null) {
                    sb.append("null");
                } else {
                    sb.append("\"").append(escape(o.toString())).append("\"");
                }
            }
            c0++;
        }
        sb.append('}');
    }