Class SimpleJsonWriter


public class SimpleJsonWriter extends TextWriter
Writes JSON in the following simple format.
  • Constructor Details

    • SimpleJsonWriter

      public SimpleJsonWriter(File file)
    • SimpleJsonWriter

      public SimpleJsonWriter(Writer writer)
  • Method Details

    • isPretty

      public boolean isPretty()
      Indicates if line breaks and indentations should be added to output (default false).
    • setPretty

      public SimpleJsonWriter setPretty(boolean pretty)
      Indicates if line breaks and indentations should be added to output (default false).
      Example output (pretty = true):
      [
        {
          "country":"Philippines"
          ,"capital":"Manila"
        }
      ]

      Example output (pretty = false):
      [{"country":"Philippines","capital":"Manila"}]

    • open

      public void open()
      Description copied from class: DataEndpoint
      Makes this endpoint ready for reading or writing.
      Overrides:
      open in class AbstractWriter
    • close

      public void close()
      Description copied from class: DataEndpoint
      Indicates that this endpoint has finished reading or writing.
      Overrides:
      close in class TextWriter
    • writeRecord

      protected void writeRecord(Record record) throws Throwable
      Description copied from class: AbstractWriter
      Writes one row; called first for the header row (see AbstractWriter.isHeaderRow()) when field names are written, then for each record.
      Specified by:
      writeRecord in class AbstractWriter
      Throws:
      Throwable