Interface JsonGenerator


public interface JsonGenerator
Represents interface to the underlying JAXB implementation, which handles the actual value serialization.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Writes a closing marker of a JSON array value(the ']' character).
    void
    Writes an opening marker of a JSON array value (the '[' character).
    void
    writeBoolean(boolean value)
    Outputs the given boolean value as a JSON boolean.
    void
    Writes a field name (JSON string surrounded by double quotes).
    void
    Outputs JSON literal null value.
    void
    Outputs the given numeric value as a JSON number.
    void
    Writes a closing marker of a JSON object value (the '}' character).
    void
    Writes a starting marker of a JSON object value (the '{' character).
    void
    Outputs a String value.
  • Method Details

    • writeFieldName

      void writeFieldName(String name) throws IOException
      Writes a field name (JSON string surrounded by double quotes).

      Can be used only in an object, when a field name is expected.

      Parameters:
      name - Field name to write
      Throws:
      IOException - When JSON writing error occurs
    • writeObjectStart

      void writeObjectStart() throws IOException
      Writes a starting marker of a JSON object value (the '{' character).

      Can be used anywhere except when a field name is expected.

      Throws:
      IOException - When JSON writing error occurs
    • writeObjectEnd

      void writeObjectEnd() throws IOException
      Writes a closing marker of a JSON object value (the '}' character).

      Can be used for closing objects either after a complete value or an object opening marker.

      Throws:
      IOException - When JSON writing error occurs
    • writeArrayStart

      void writeArrayStart() throws IOException
      Writes an opening marker of a JSON array value (the '[' character).

      Can be used anywhere except when a field name is expected.

      Throws:
      IOException - When JSON writing error occurs
    • writeArrayEnd

      void writeArrayEnd() throws IOException
      Writes a closing marker of a JSON array value(the ']' character).

      Can be used when the innermost structured type is array.

      Throws:
      IOException - When JSON writing error occurs
    • writeNumber

      void writeNumber(Number number) throws IOException
      Outputs the given numeric value as a JSON number.
      Parameters:
      number - Number to write
      Throws:
      IOException - When JSON writing error occurs
    • writeBoolean

      void writeBoolean(boolean value) throws IOException
      Outputs the given boolean value as a JSON boolean.
      Parameters:
      value - Value to write
      Throws:
      IOException - When JSON writing error occurs
    • writeNull

      void writeNull() throws IOException
      Outputs JSON literal null value.

      This is usually not used, because null values are by default omitted by the serialization. But this can be configurable.

      Throws:
      IOException - When JSON writing error occurs
    • writeString

      void writeString(String text) throws IOException
      Outputs a String value.

      Escaping will be done by the underlying implementation.

      Parameters:
      text - Text to write
      Throws:
      IOException - When JSON writing error occurs