Class JsonGrammar.Builder

java.lang.Object
blue.endless.jankson.JsonGrammar.Builder
Enclosing class:
JsonGrammar

public static class JsonGrammar.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • withComments

      public JsonGrammar.Builder withComments(boolean comments)
      Indicates that comments should be accepted as input, and preserved in output. Defaults to true.
    • printWhitespace

      public JsonGrammar.Builder printWhitespace(boolean whitespace)
      Indicates whether additional tabs and newlines should be printed to make json more readable for humans. If false, output will be somewhat minified to save space. Defaults to true.
    • printCommas

      public JsonGrammar.Builder printCommas(boolean commas)
      Indicates whether commas should be output to make the result more readable. Setting this to false will cause the output to be invalid JSON5! (but still correct Jankson). Defaults to true.
    • printTrailingCommas

      public JsonGrammar.Builder printTrailingCommas(boolean trailing)
      If true, JSON5 trailing commas will be printed in all objects and lists. Has no affect on parsing, and has no effect on output if printCommas(boolean) is false. Defaults to false.
    • bareSpecialNumerics

      public JsonGrammar.Builder bareSpecialNumerics(boolean bare)
      When printing output, print numeric values like NaN and Infinity without quotes. These will get picked up by Gson and HJSON as-is, and apparently Jackson will read them as unquoted strings.
    • bareRootObject

      public JsonGrammar.Builder bareRootObject(boolean bare)
      When printing out a root object, omit the opening and closing braces ( "{}" ). Loading a file generated with this setting requires setting allowBareRootObject in the builder for the Jankson object that will load them.
    • printUnquotedKeys

      public JsonGrammar.Builder printUnquotedKeys(boolean unquoted)
    • build

      public JsonGrammar build()
      Finalizes this JsonGrammar and returns it.