--- ANNOTATION TO JSON CONVERTER ---
433124
public static final void convertAnnotations(Tree config, Annotation[] annotations)
			throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
		for (Annotation annotation : annotations) {

			// Create entry for annotation
			String annotationName = annotation.toString();
			int i = annotationName.lastIndexOf('.');
			if (i > -1) {
				annotationName = annotationName.substring(i + 1);
			}
			i = annotationName.indexOf('(');
			if (i > -1) {
				annotationName = annotationName.substring(0, i);
			}
			if (annotationName.length() > 1) {
				annotationName = Character.toLowerCase(annotationName.charAt(0)) + annotationName.substring(1);
			} else {
				annotationName = annotationName.toLowerCase();
			}
			if ("name".equals(annotationName) || "override".equals(annotationName)) {
				continue;
			}
			Tree annotationMap = config.putMap(annotationName);

			// Add annotation values
			Class<? extends Annotation> type = annotation.annotationType();
			Method[] members = type.getDeclaredMethods();
			for (Method member : members) {
				member.setAccessible(true);
				String propName = member.getName();
				Object propValue = member.invoke(annotation);
				annotationMap.putObject(propName, propValue);
				Tree newChild = annotationMap.get(propName);
				if (newChild.size() < 1) {
					newChild.remove();
				}
			}
			int size = annotationMap.size();
			if (size == 0) {
				annotationMap.remove();
			} else if (size == 1) {
				Tree value = annotationMap.getFirstChild();
				if (value != null && "value".equals(value.getName())) {
					annotationMap.setObject(value.asObject());
				}
			}
		}
	}
1084836
private static Object toJson(JsonObject obj, JsonBuilderFactory factory) {
		return obj.toJson(factory.createJsonBuilder());
	}
204128
@Override
    public JSONObject toJSON(StaticRouting routing) {
        JSONObject o = new JSONObject();
        o.put("type", getJSONId());
        JSONArray a = new JSONArray();
        Map<StaticRouting.NodesMap, Map<Link, Boolean>> routes = routing.getStaticRoutes();
        for (Map.Entry<StaticRouting.NodesMap, Map<Link, Boolean>> e : routes.entrySet()) {
            StaticRouting.NodesMap nm = e.getKey();
            JSONObject ao = new JSONObject();
            ao.put("nodes_map", nodesMapToJSON(nm));
            JSONArray links = new JSONArray();
            Map<Link, Boolean> v = e.getValue();
            for (Link l : v.keySet()) {
                JSONObject lo = new JSONObject();
                lo.put("link", l.id());
                lo.put("direction", routes.get(nm).get(l).toString());
                links.add(lo);
            }
            ao.put("links", links);
            a.add(ao);
        }
        o.put(ROUTES_LABEL, a);
        return o;
    }
854219
public String toJson(Object o) {
		try {
			String json = objectMapper.writeValueAsString(o);
			LOG.debug(json);
			return json;
		} catch (Exception e) {
			throw Exceptions.propagate(e);
		}
	}
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;
    }
528681
private JsonConvertOptions getJsonConverterOptions(JsonMBean pAnno) {
        // Extract conversion options from the annotation
        if (pAnno == null) {
            return JsonConvertOptions.DEFAULT;
        } else {
            ValueFaultHandler faultHandler =
                    pAnno.faultHandling() == JsonMBean.FaultHandler.IGNORE_ERRORS ?
                            ValueFaultHandler.IGNORING_VALUE_FAULT_HANDLER :
                            ValueFaultHandler.THROWING_VALUE_FAULT_HANDLER;
            return new JsonConvertOptions.Builder()
                    .maxCollectionSize(pAnno.maxCollectionSize())
                    .maxDepth(pAnno.maxDepth())
                    .maxObjects(pAnno.maxObjects())
                    .faultHandler(faultHandler)
                    .build();
        }
    }
6564
public static String toJSONString(final Object obj) {
        try {
            return mapper.writeValueAsString(obj);
        } catch (final JsonProcessingException e) {
            logger.error("Cannot to JSON string", e);
        }
        return null;
    }
1337457
protected String toJson(Object value) {

		OBJECT_MAPPER.setDateFormat(AppConfig.DATE_FORMAT);
		try {
			return OBJECT_MAPPER.writeValueAsString(value);

		} catch (JsonGenerationException e) {
			throw new RuntimeException(e);
		} catch (JsonMappingException e) {
			throw new RuntimeException(e);
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}
1020085
public JSONObject convertToJson() {
        JSONObject buoJsonModel = new JSONObject();
        try {
            // Add all keys in plane format  initially. All known keys will be replaced with corresponding data type in the following section
            JSONObject metadataJsonObject = metadata_.convertToJson();
            Iterator<String> keys = metadataJsonObject.keys();
            while (keys.hasNext()) {
                String key = keys.next();
                buoJsonModel.put(key, metadataJsonObject.get(key));
            }
            if (!TextUtils.isEmpty(title_)) {
                buoJsonModel.put(Defines.Jsonkey.ContentTitle.getKey(), title_);
            }
            if (!TextUtils.isEmpty(canonicalIdentifier_)) {
                buoJsonModel.put(Defines.Jsonkey.CanonicalIdentifier.getKey(), canonicalIdentifier_);
            }
            if (!TextUtils.isEmpty(canonicalUrl_)) {
                buoJsonModel.put(Defines.Jsonkey.CanonicalUrl.getKey(), canonicalUrl_);
            }
            if (keywords_.size() > 0) {
                JSONArray keyWordJsonArray = new JSONArray();
                for (String keyword : keywords_) {
                    keyWordJsonArray.put(keyword);
                }
                buoJsonModel.put(Defines.Jsonkey.ContentKeyWords.getKey(), keyWordJsonArray);
            }
            if (!TextUtils.isEmpty(description_)) {
                buoJsonModel.put(Defines.Jsonkey.ContentDesc.getKey(), description_);
            }
            if (!TextUtils.isEmpty(imageUrl_)) {
                buoJsonModel.put(Defines.Jsonkey.ContentImgUrl.getKey(), imageUrl_);
            }
            if (expirationInMilliSec_ > 0) {
                buoJsonModel.put(Defines.Jsonkey.ContentExpiryTime.getKey(), expirationInMilliSec_);
            }
            buoJsonModel.put(Defines.Jsonkey.PublicallyIndexable.getKey(), isPublicallyIndexable());
            buoJsonModel.put(Defines.Jsonkey.LocallyIndexable.getKey(), isLocallyIndexable());
            buoJsonModel.put(Defines.Jsonkey.CreationTimestamp.getKey(), creationTimeStamp_);
            
        } catch (JSONException ignore) {
        }
        return buoJsonModel;
    }
28855
def jsondeclarations(self):
        
        l = []
        for annotationtype, set in self.annotations:
            label = None
            #Find the 'label' for the declarations dynamically (aka: AnnotationType --> String)
            for key, value in vars(AnnotationType).items():
                if value == annotationtype:
                    label = key
                    break
            #gather attribs

            if (annotationtype == AnnotationType.TEXT or annotationtype == AnnotationType.PHON) and set == 'undefined' and len(self.annotationdefaults[annotationtype][set]) == 0:
                #this is the implicit TextContent declaration, no need to output it explicitly
                continue

            jsonnode = {'annotationtype': label.lower()}
            if set and set != 'undefined':
                jsonnode['set'] = set


            for key, value in self.annotationdefaults[annotationtype][set].items():
                if key == 'annotatortype':
                    if value == AnnotatorType.MANUAL:
                        jsonnode[key] = 'manual'
                    elif value == AnnotatorType.AUTO:
                        jsonnode[key] = 'auto'
                elif key == 'datetime':
                    jsonnode[key] = value.strftime("%Y-%m-%dT%H:%M:%S") #proper iso-formatting
                elif value:
                    jsonnode[key] = value
            if label:
                l.append( jsonnode  )
            else:
                raise Exception("Invalid annotation type")
        return l
408833
public static JsonNode toJson(Object obj, ClassLoader classLoader) {
        return SerializationUtils.toJson(obj, classLoader);
    }
821816
private static JsonStructure toJson( VarValueDef value)
    {
    JsonObjectBuilder builder = Json.createObjectBuilder();

    if( value.getType().equals( FAILURE))
      {
      builder.add( FAILURE_KEY, true);
      }
    else if( value.getType().equals( ONCE))
      {
      builder.add( ONCE_KEY, true);
      }

    addAnnotations( builder, value);

    ConditionJson.toJson( value).ifPresent( json -> builder.add( WHEN_KEY, json));
      
    addProperties( builder, value);

    return builder.build();
    }
600820
public static String toJson(Object obj) {
		ObjectMapper mapper = new ObjectMapper();
		try {
			return mapper.writeValueAsString(obj);
		} catch (IOException e) {
			JK.throww(e);
			return null;
		}
	}
1294546
public JsonNode toJson() {
		ObjectMapper mapper = new ObjectMapper();
		ObjectNode node = mapper.createObjectNode();

		ArrayNode columnsNode = mapper.createArrayNode();
		for (DataColumn column : columns) {
			columnsNode.add(column.toJson());
		}
		ArrayNode dataNode = mapper.createArrayNode();
		for (DataRow row : rows) {
			dataNode.add(row.toJson());
		}

		node.put("columns", columnsNode);
		node.put("data", dataNode);
		node.put("overwrite", overwritePolicy.toJson());
		if (templateId != null) {
			node.put("templateId", templateId);
		}
		if (splitByColumn != null) {
			node.put("splitByColumn", splitByColumn);
		}
		return node;
	}
513193
public static String toJsonString(Collection<Attribute> attributeCollection, ObjectMapper objectMapper) throws JsonProcessingException {
        return objectMapper.writeValueAsString(toObject(attributeCollection));
    }
543260
private static String toJSON(Object data) {
        try {
            return mapper.writeValueAsString(data);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
698919
public JSONObject toJSON() {
        JSONObject ret = new JSONObject();
        ret.put("url", url);
        if (env != null) {
            ret.put("env", env);
        }
        return ret;
    }