Interface JsonWriter

All Superinterfaces:
AutoCloseable, Closeable, Flushable
All Known Subinterfaces:
BufferedJsonWriter, BytesJsonWriter
All Known Implementing Classes:
DelegateJsonWriter

public interface JsonWriter extends Closeable, Flushable
Writes json content.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Write array begin.
    void
    Write object begin.
    void
    Close the writer.
    void
    Write empty array.
    void
    Write array end.
    void
    Write object end.
    void
    Flush the writer.
    void
    Write a value that could be any value.
    void
    name(int position)
    Set the next property name to write by position.
    void
    name(String name)
    Set the next property name to write.
    void
    Set the current property names.
    void
    Write null value.
    Return the current path.
    void
    pretty(boolean pretty)
    Set tp true to output json in pretty format.
    boolean
    Return true if empty collections should be serialised.
    void
    serializeEmpty(boolean serializeEmpty)
    Set to serialise empty collections or not.
    boolean
    Return true if null values should be serialised.
    void
    serializeNulls(boolean serializeNulls)
    Set to serialise null values or not.
    void
    value(boolean value)
    Write a boolean value.
    void
    value(double value)
    Write a double value.
    void
    value(int value)
    Write an int value.
    void
    value(long value)
    Write a long value.
    void
    value(Boolean value)
    Write a Boolean value.
    void
    value(Double value)
    Write a Double value.
    void
    value(Integer value)
    Write an Integer value.
    void
    value(Long value)
    Write a Long value.
    void
    value(String value)
    Write a string value.
    void
    Write a BigDecimal value.
    void
    Write a BigInteger value.
    void
    writeRaw(char ch)
    Write raw content.
  • Method Details

    • serializeNulls

      void serializeNulls(boolean serializeNulls)
      Set to serialise null values or not.
    • serializeNulls

      boolean serializeNulls()
      Return true if null values should be serialised.
    • serializeEmpty

      void serializeEmpty(boolean serializeEmpty)
      Set to serialise empty collections or not.
    • serializeEmpty

      boolean serializeEmpty()
      Return true if empty collections should be serialised.
    • pretty

      void pretty(boolean pretty)
      Set tp true to output json in pretty format.
    • path

      Return the current path.
    • names

      void names(PropertyNames names)
      Set the current property names.
    • name

      void name(int position)
      Set the next property name to write by position.
    • name

      void name(String name)
      Set the next property name to write.

      This is generally less efficient than using names(PropertyNames) and name(int).

    • beginArray

      void beginArray()
      Write array begin.
    • endArray

      void endArray()
      Write array end.
    • emptyArray

      void emptyArray()
      Write empty array.
    • beginObject

      void beginObject()
      Write object begin.
    • endObject

      void endObject()
      Write object end.
    • nullValue

      void nullValue()
      Write null value.
    • value

      void value(String value)
      Write a string value.
    • value

      void value(boolean value)
      Write a boolean value.
    • value

      void value(int value)
      Write an int value.
    • value

      void value(long value)
      Write a long value.
    • value

      void value(double value)
      Write a double value.
    • value

      void value(Boolean value)
      Write a Boolean value.
    • value

      void value(Integer value)
      Write an Integer value.
    • value

      void value(Long value)
      Write a Long value.
    • value

      void value(Double value)
      Write a Double value.
    • value

      void value(BigDecimal value)
      Write a BigDecimal value.
    • value

      void value(BigInteger value)
      Write a BigInteger value.
    • jsonValue

      void jsonValue(Object value)
      Write a value that could be any value.
    • writeRaw

      void writeRaw(char ch)
      Write raw content. This is typically used to write new line characters for x-json-stream content.
    • flush

      void flush()
      Flush the writer.
      Specified by:
      flush in interface Flushable
    • close

      void close()
      Close the writer.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable