Search in sources :

Example 6 with DefaultPrettyPrinter

use of com.fasterxml.jackson.core.util.DefaultPrettyPrinter in project midpoint by Evolveum.

the class JsonLexicalProcessor method createJsonGenerator.

private JsonGenerator createJsonGenerator(StringWriter out) throws SchemaException {
    try {
        JsonFactory factory = new JsonFactory();
        JsonGenerator generator = factory.createGenerator(out);
        generator.setPrettyPrinter(new DefaultPrettyPrinter());
        generator.setCodec(configureMapperForSerialization());
        return generator;
    } catch (IOException ex) {
        throw new SchemaException("Schema error during serializing to JSON.", ex);
    }
}
Also used : DefaultPrettyPrinter(com.fasterxml.jackson.core.util.DefaultPrettyPrinter) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) JsonFactory(com.fasterxml.jackson.core.JsonFactory) JsonGenerator(com.fasterxml.jackson.core.JsonGenerator) IOException(java.io.IOException)

Example 7 with DefaultPrettyPrinter

use of com.fasterxml.jackson.core.util.DefaultPrettyPrinter in project geode by apache.

the class PdxToJSON method enableDisableJSONGeneratorFeature.

private void enableDisableJSONGeneratorFeature(JsonGenerator jg) {
    jg.enable(Feature.ESCAPE_NON_ASCII);
    jg.disable(Feature.AUTO_CLOSE_TARGET);
    jg.setPrettyPrinter(new DefaultPrettyPrinter());
    if (PDXTOJJSON_UNQUOTEFIELDNAMES)
        jg.disable(Feature.QUOTE_FIELD_NAMES);
}
Also used : DefaultPrettyPrinter(com.fasterxml.jackson.core.util.DefaultPrettyPrinter)

Aggregations

DefaultPrettyPrinter (com.fasterxml.jackson.core.util.DefaultPrettyPrinter)7 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)2 IOException (java.io.IOException)2 MidpointYAMLFactory (com.evolveum.midpoint.prism.lex.json.yaml.MidpointYAMLFactory)1 MidpointYAMLGenerator (com.evolveum.midpoint.prism.lex.json.yaml.MidpointYAMLGenerator)1 JsonFactory (com.fasterxml.jackson.core.JsonFactory)1 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)1 PrettyPrinter (com.fasterxml.jackson.core.PrettyPrinter)1 DefaultIndenter (com.fasterxml.jackson.core.util.DefaultIndenter)1