Search in sources :

Example 1 with ObjectTypeWriter

use of com.serotonin.json.type.ObjectTypeWriter in project ma-core-public by infiniteautomation.

the class JsonSerializableUtility method convertMapToJsonObject.

/**
 */
public static JsonObject convertMapToJsonObject(Map<String, Object> map) throws JsonException {
    JsonTypeWriter typeWriter = new JsonTypeWriter(Common.JSON_CONTEXT);
    ObjectTypeWriter writer = new ObjectTypeWriter(typeWriter);
    Iterator<String> it = map.keySet().iterator();
    while (it.hasNext()) {
        String name = it.next();
        writer.writeEntry(name, map.get(name));
    }
    return writer.getJsonObject();
}
Also used : ObjectTypeWriter(com.serotonin.json.type.ObjectTypeWriter) JsonTypeWriter(com.serotonin.json.type.JsonTypeWriter)

Aggregations

JsonTypeWriter (com.serotonin.json.type.JsonTypeWriter)1 ObjectTypeWriter (com.serotonin.json.type.ObjectTypeWriter)1