Class JSONOutput

java.lang.Object
com.invirgance.convirgance.output.JSONOutput
All Implemented Interfaces:
Output

@Wiring public class JSONOutput extends Object implements Output
Provides support for writing a stream of data as JSON formatted objects. This format will simulate a JSON array by writing opening and closing brackets along with commas after each JSON object. This makes the JSON compatible with most viewer tools and query tools like jq. JSON objects are written one per line to make the output easier to verify with unix command-line tools.
Author:
jbanes
  • Constructor Details

    • JSONOutput

      public JSONOutput()
  • Method Details

    • write

      public OutputCursor write(Target target)
      Obtain an output cursor to manually write data to the output stream
      Specified by:
      write in interface Output
      Parameters:
      target - a target to which the data will be written
      Returns:
      a cursor to write data to
    • getContentType

      public String getContentType()
      Returns the MIME type 'application/json'
      Specified by:
      getContentType in interface Output
      Returns:
      the mime type for this format