本文整理汇总了Java中com.fasterxml.jackson.core.JsonGenerator.writeTree方法的典型用法代码示例。如果您正苦于以下问题:Java JsonGenerator.writeTree方法的具体用法?Java JsonGenerator.writeTree怎么用?Java JsonGenerator.writeTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.core.JsonGenerator
的用法示例。
在下文中一共展示了JsonGenerator.writeTree方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeStartObject();
gen.writeStringField("op", op);
gen.writeStringField("path", path.toString());
gen.writeFieldName("oldValue");
gen.writeTree(oldValue);
gen.writeFieldName("value");
gen.writeTree(newValue);
gen.writeEndObject();
}
示例2: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public final void serialize(final JsonGenerator jgen,
final SerializerProvider provider) throws IOException {
jgen.writeStartObject();
jgen.writeStringField("op", op);
jgen.writeStringField("path", path.toString());
jgen.writeFieldName("value");
jgen.writeTree(value);
jgen.writeEndObject();
}
示例3: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(JSONOptions value, JsonGenerator jgen, SerializerProvider provider) throws IOException,
JsonGenerationException {
if (value.opaque != null) {
jgen.writeObject(value.opaque);
} else {
jgen.writeTree(value.root);
}
}
示例4: serialize
import com.fasterxml.jackson.core.JsonGenerator; //导入方法依赖的package包/类
@Override
public void serialize(T value, JsonGenerator jgen,
SerializerProvider provider) throws IOException,
JsonGenerationException {
String content = serialize(value);
JsonNode node = this.objectMapper.readTree(content);
jgen.writeTree(node);
}