Module json5

Class JSONOptions.JSONOptionsBuilder

java.lang.Object
at.syntaxerror.json5.JSONOptions.JSONOptionsBuilder
Enclosing class:
JSONOptions

public static class JSONOptions.JSONOptionsBuilder extends Object
  • Method Details

    • parseInstants

      public JSONOptions.JSONOptionsBuilder parseInstants(boolean parseInstants)
      Whether instants should be parsed as such. If this is false, JSONOptions.isParseStringInstants() and JSONOptions.isParseUnixInstants() are ignored

      Default: true

      This is a Parser-only option

      Parameters:
      parseInstants - a boolean
      Returns:
      this.
      Since:
      1.1.0
    • parseStringInstants

      public JSONOptions.JSONOptionsBuilder parseStringInstants(boolean parseStringInstants)
      Whether string instants (according to RFC 3339, Section 5.6) should be parsed as such. Ignored if JSONOptions.isParseInstants() is false

      Default: true

      This is a Parser-only option

      Parameters:
      parseStringInstants - a boolean
      Returns:
      this.
      Since:
      1.1.0
    • parseUnixInstants

      public JSONOptions.JSONOptionsBuilder parseUnixInstants(boolean parseUnixInstants)
      Whether unix instants (integers) should be parsed as such. Ignored if JSONOptions.isParseInstants() is false

      Default: true

      This is a Parser-only option

      Parameters:
      parseUnixInstants - a boolean
      Returns:
      this.
      Since:
      1.1.0
    • 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
    • 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
    • duplicateBehaviour

      public JSONOptions.JSONOptionsBuilder duplicateBehaviour(JSONOptions.DuplicateBehavior duplicateBehaviour)
      Specifies the behavior when the same key is encountered multiple times within the same JSONObject

      Default: UNIQUE

      This is a Parser-only option

      Parameters:
      duplicateBehaviour - the behavior
      Returns:
      this.
      Since:
      1.3.0
    • build

      public JSONOptions build()
    • toString

      public String toString()
      Overrides:
      toString in class Object