Class JSONValueNull


  • public class JSONValueNull
    extends JSONValuePrimitive
    Represents one JSON 'null' value.

    Instances of this class are immutable.

    • Field Detail

      • INSTANCE

        public static final JSONValueNull INSTANCE
        An instance of null value without token information.
    • Constructor Detail

      • JSONValueNull

        public JSONValueNull​(JSONToken token)
        Create an instance of a Java representation of a JSON null value with source JSON text information.
        Parameters:
        token - source of this JSON null value. Can be null if this JSON null value is not originated from an exiting JSON text.
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • toTokenString

        @NotNull
        public @NotNull String toTokenString()
        Description copied from class: JSONValue
        Convert this JSON value to String which can be saved as a JSON text to a file or transmitted to network. The output text is optimized for machine, so no indent or new lines will be inserted.

        Note that, according to RFC 8259 - 8.1 Character Encoding, your application program must encode the returned String using UTF-8 without BOM before writing the returned String to a file or a network stream, or network datagram(s). It is caller's responsibility to correctly encode it.

        Specified by:
        toTokenString in class JSONValue
        Returns:
        a string representation of this JSON value
      • toTokenString

        @NotNull
        public @NotNull String toTokenString​(String newline,
                                             String indent)
        Description copied from class: JSONValue
        Convert this JSON value to String which can be saved as a JSON text to a file or transmitted to network. The output text is optimized for human. Indents and new line characters are inserted accordingly.

        Note that, according to RFC 8259 - 8.1 Character Encoding, your application program must encode the returned String using UTF-8 without BOM before writing the returned String to a file or a network stream, or network datagram(s). It is caller's responsibility to correctly encode it.

        Specified by:
        toTokenString in class JSONValue
        Parameters:
        newline - line separator; "\r", "\n" or "\r\n"
        indent - indent string. Must consist of " " and "\t".
        Returns:
        a string representation of this JSON value