Module json5

Class JSONOptions.JSONOptionsBuilder

  • Enclosing class:
    JSONOptions

    public static class JSONOptions.JSONOptionsBuilder
    extends Object
    • Method Detail

      • stringifyUnixInstants

        public JSONOptions.JSONOptionsBuilder stringifyUnixInstants​(boolean stringifyUnixInstants)
        Whether instants should be stringifyed as unix timestamps. If this is false, instants will be stringifyed as strings (according to RFC 3339, Section 5.6).

        Default: false

        This is a Stringify-only option

        Parameters:
        stringifyUnixInstants - a boolean
        Returns:
        this.
        Since:
        1.1.0
      • stringifyAscii

        public JSONOptions.JSONOptionsBuilder stringifyAscii​(boolean stringifyAscii)
        Whether stringifying should only yield ASCII strings. All non-ASCII characters will be converted to their Unicode escape sequence (\uXXXX).

        Default: false

        This is a Stringify-only option

        Parameters:
        stringifyAscii - a boolean
        Returns:
        this.
        Since:
        2.0.0
      • allowNaN

        public JSONOptions.JSONOptionsBuilder allowNaN​(boolean allowNaN)
        Whether NaN should be allowed as a number

        Default: true

        Parameters:
        allowNaN - a boolean
        Returns:
        this.
        Since:
        1.1.0
      • allowInfinity

        public JSONOptions.JSONOptionsBuilder allowInfinity​(boolean allowInfinity)
        Whether Infinity should be allowed as a number. This applies to both +Infinity and -Infinity

        Default: true

        Parameters:
        allowInfinity - a boolean
        Returns:
        this.
        Since:
        1.1.0
      • allowInvalidSurrogates

        public JSONOptions.JSONOptionsBuilder allowInvalidSurrogates​(boolean allowInvalidSurrogates)
        Whether invalid unicode surrogate pairs should be allowed

        Default: true

        This is a Parser-only option

        Parameters:
        allowInvalidSurrogates - a boolean
        Returns:
        this.
        Since:
        1.1.0
      • quoteSingle

        public JSONOptions.JSONOptionsBuilder quoteSingle​(boolean quoteSingle)
        Whether strings should be single-quoted (') instead of double-quoted ("). This also includes a JSONObject's member names

        Default: false

        This is a Stringify-only option

        Parameters:
        quoteSingle - a boolean
        Returns:
        this.
        Since:
        1.1.0
      • allowBinaryLiterals

        public JSONOptions.JSONOptionsBuilder allowBinaryLiterals​(boolean allowBinaryLiterals)
        Whether binary literals (0b10101...) should be allowed

        Default: false

        This is a Parser-only option

        Parameters:
        allowBinaryLiterals - a boolean
        Returns:
        this.
        Since:
        2.0.0
      • allowOctalLiterals

        public JSONOptions.JSONOptionsBuilder allowOctalLiterals​(boolean allowOctalLiterals)
        Whether octal literals (0o567...) should be allowed

        Default: false

        This is a Parser-only option

        Parameters:
        allowOctalLiterals - a boolean
        Returns:
        this.
        Since:
        2.0.0
      • allowHexFloatingLiterals

        public JSONOptions.JSONOptionsBuilder allowHexFloatingLiterals​(boolean allowHexFloatingLiterals)
        Whether hexadecimal floating-point literals (e.g. 0xA.BCp+12) should be allowed

        Default: false

        This is a Parser-only option

        Parameters:
        allowHexFloatingLiterals - a boolean
        Returns:
        this.
        Since:
        2.0.0
      • allowJavaDigitSeparators

        public JSONOptions.JSONOptionsBuilder allowJavaDigitSeparators​(boolean allowJavaDigitSeparators)
        Whether Java-style digit separators (123_456) should be allowed

        Default: false

        This is a Parser-only option

        Parameters:
        allowJavaDigitSeparators - a boolean
        Returns:
        this.
        Since:
        2.0.0
      • allowCDigitSeparators

        public JSONOptions.JSONOptionsBuilder allowCDigitSeparators​(boolean allowCDigitSeparators)
        Whether C-style digit separators (123'456) should be allowed

        Default: false

        This is a Parser-only option

        Parameters:
        allowCDigitSeparators - a boolean
        Returns:
        this.
        Since:
        2.0.0
      • allowLongUnicodeEscapes

        public JSONOptions.JSONOptionsBuilder allowLongUnicodeEscapes​(boolean allowLongUnicodeEscapes)
        Whether 32-bit unicode escape sequences (\U00123456) should be allowed

        Default: false

        This is a Parser-only option

        Parameters:
        allowLongUnicodeEscapes - a boolean
        Returns:
        this.
        Since:
        2.0.0