Skip to content

Instantly share code, notes, and snippets.

@electrum
Created June 1, 2010 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save electrum/421210 to your computer and use it in GitHub Desktop.
Save electrum/421210 to your computer and use it in GitHub Desktop.
public class NewlinePrettyPrinter implements PrettyPrinter
{
@Override
public void writeRootValueSeparator(JsonGenerator jg) throws IOException
{
jg.writeRaw('\n');
}
@Override
public void writeStartObject(JsonGenerator jg) throws IOException
{
jg.writeRaw('{');
}
@Override
public void writeEndObject(JsonGenerator jg, int nrOfEntries) throws IOException
{
jg.writeRaw('}');
}
@Override
public void writeObjectEntrySeparator(JsonGenerator jg) throws IOException
{
jg.writeRaw(',');
}
@Override
public void writeObjectFieldValueSeparator(JsonGenerator jg) throws IOException
{
jg.writeRaw(':');
}
@Override
public void writeStartArray(JsonGenerator jg) throws IOException
{
jg.writeRaw('[');
}
@Override
public void writeEndArray(JsonGenerator jg, int nrOfValues) throws IOException
{
jg.writeRaw(']');
}
@Override
public void writeArrayValueSeparator(JsonGenerator jg) throws IOException
{
jg.writeRaw(',');
}
@Override
public void beforeArrayValues(JsonGenerator jg) throws IOException
{
// ignore
}
@Override
public void beforeObjectEntries(JsonGenerator jg) throws IOException
{
// ignore
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment