use of com.fasterxml.jackson.databind.util.RawValue in project jackson-databind by FasterXML.
the class TestJsonNode method testRawValue.
// [databind#743]
public void testRawValue() throws Exception {
ObjectNode root = MAPPER.createObjectNode();
root.putRawValue("a", new RawValue(new SerializedString("[1, 2, 3]")));
assertEquals("{\"a\":[1, 2, 3]}", MAPPER.writeValueAsString(root));
}
use of com.fasterxml.jackson.databind.util.RawValue in project jackson-databind by FasterXML.
the class RawValueTest method testRawFromMapToTree.
// for [databind#743]
public void testRawFromMapToTree() throws Exception {
RawValue myType = new RawValue("Jackson");
Map<String, Object> object = new HashMap<String, Object>();
object.put("key", myType);
JsonNode jsonNode = MAPPER.valueToTree(object);
String json = MAPPER.writeValueAsString(jsonNode);
assertEquals("{\"key\":Jackson}", json);
}
Aggregations