Java Code Examples for com.fasterxml.jackson.core.util.DefaultIndenter#SYSTEM_LINEFEED_INSTANCE
The following examples show how to use
com.fasterxml.jackson.core.util.DefaultIndenter#SYSTEM_LINEFEED_INSTANCE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractSPARQLJSONWriter.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void startDocument() throws QueryResultHandlerException { if (!documentOpen) { documentOpen = true; headerOpen = false; headerComplete = false; tupleVariablesFound = false; firstTupleWritten = false; linksFound = false; if (getWriterConfig().get(BasicWriterSettings.PRETTY_PRINT)) { // SES-2011: Always use \n for consistency Indenter indenter = DefaultIndenter.SYSTEM_LINEFEED_INSTANCE; // By default Jackson does not pretty print, so enable this unless // PRETTY_PRINT setting is disabled DefaultPrettyPrinter pp = new DefaultPrettyPrinter().withArrayIndenter(indenter) .withObjectIndenter(indenter); jg.setPrettyPrinter(pp); } try { if (getWriterConfig().isSet(BasicQueryWriterSettings.JSONP_CALLBACK)) { // SES-1019 : Write the callbackfunction name as a wrapper for // the results here String callbackName = getWriterConfig().get(BasicQueryWriterSettings.JSONP_CALLBACK); jg.writeRaw(callbackName); jg.writeRaw("("); } jg.writeStartObject(); } catch (IOException e) { throw new QueryResultHandlerException(e); } } }
Example 2
Source File: RDFJSONWriter.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static void modelToRdfJsonInternal(final Model graph, final WriterConfig writerConfig, final JsonGenerator jg) throws IOException, JsonGenerationException { if (writerConfig.get(BasicWriterSettings.PRETTY_PRINT)) { // SES-2011: Always use \n for consistency Indenter indenter = DefaultIndenter.SYSTEM_LINEFEED_INSTANCE; // By default Jackson does not pretty print, so enable this unless // PRETTY_PRINT setting is disabled DefaultPrettyPrinter pp = new DefaultPrettyPrinter().withArrayIndenter(indenter) .withObjectIndenter(indenter); jg.setPrettyPrinter(pp); } jg.writeStartObject(); for (final Resource nextSubject : graph.subjects()) { jg.writeObjectFieldStart(RDFJSONWriter.resourceToString(nextSubject)); for (final IRI nextPredicate : graph.filter(nextSubject, null, null).predicates()) { jg.writeArrayFieldStart(nextPredicate.stringValue()); for (final Value nextObject : graph.filter(nextSubject, nextPredicate, null).objects()) { // contexts are optional, so this may return empty in some // scenarios depending on the interpretation of the way contexts // work final Set<Resource> contexts = graph.filter(nextSubject, nextPredicate, nextObject).contexts(); RDFJSONWriter.writeObject(nextObject, contexts, jg); } jg.writeEndArray(); } jg.writeEndObject(); } jg.writeEndObject(); }
Example 3
Source File: EvaluateEventJsonGeneratorTest.java From kogito-runtimes with Apache License 2.0 | 4 votes |
public TestPrettyPrinter() { _arrayIndenter = DefaultIndenter.SYSTEM_LINEFEED_INSTANCE; _objectFieldValueSeparatorWithSpaces = ": "; }
Example 4
Source File: JsonFormatter.java From alexa-utterance-generator with Apache License 2.0 | 4 votes |
PrettyPrinter() { _arrayIndenter = DefaultIndenter.SYSTEM_LINEFEED_INSTANCE; }
Example 5
Source File: BatfishObjectMapper.java From batfish with Apache License 2.0 | 4 votes |
public PrettyPrinter() { _arrayIndenter = DefaultIndenter.SYSTEM_LINEFEED_INSTANCE; }
Example 6
Source File: JsonUtils.java From render with GNU General Public License v2.0 | 4 votes |
public ArraysOnNewLinePrettyPrinter() { _arrayIndenter = DefaultIndenter.SYSTEM_LINEFEED_INSTANCE; }