Class JsonGrammar

java.lang.Object
blue.endless.jankson.JsonGrammar

public class JsonGrammar extends Object
Represents a style of json written out, and a set of quirks to parse going in. Typically you'll want to use a different grammar in than out.
  • Field Details

    • JANKSON

      public static final JsonGrammar JANKSON
      A grammar which will accept all supported quirks, and output JSON-with-comments, which is a valid jankson subset. This is the default behavior.
    • JSON5

      public static final JsonGrammar JSON5
      A grammar which will accept JSON5 and output JSON-with-comments with trailing commas.
    • STRICT

      public static final JsonGrammar STRICT
      A grammar which will only accept or output strict JSON.
    • COMPACT

      public static final JsonGrammar COMPACT
      A grammar which will print compactified JSON readable by almost all vanilla json parsers. (Note: Jackson may read special numerics like NaN in as Strings)
    • comments

      protected boolean comments
    • printWhitespace

      protected boolean printWhitespace
    • printCommas

      protected boolean printCommas
    • printTrailingCommas

      protected boolean printTrailingCommas
    • bareSpecialNumerics

      protected boolean bareSpecialNumerics
    • bareRootObject

      protected boolean bareRootObject
    • printUnquotedKeys

      protected boolean printUnquotedKeys
  • Constructor Details

    • JsonGrammar

      public JsonGrammar()
  • Method Details

    • hasComments

      public boolean hasComments()
    • shouldOutputWhitespace

      public boolean shouldOutputWhitespace()
    • builder

      public static JsonGrammar.Builder builder()