Package blue.endless.jankson
Class JsonGrammar.Builder
java.lang.Object
blue.endless.jankson.JsonGrammar.Builder
- Enclosing class:
- JsonGrammar
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbareRootObject(boolean bare) When printing out a root object, omit the opening and closing braces ( "{}" ).bareSpecialNumerics(boolean bare) When printing output, print numeric values like NaN and Infinity without quotes.build()Finalizes this JsonGrammar and returns it.printCommas(boolean commas) Indicates whether commas should be output to make the result more readable.printTrailingCommas(boolean trailing) If true, JSON5 trailing commas will be printed in all objects and lists.printUnquotedKeys(boolean unquoted) printWhitespace(boolean whitespace) Indicates whether additional tabs and newlines should be printed to make json more readable for humans.withComments(boolean comments) Indicates that comments should be accepted as input, and preserved in output.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
withComments
Indicates that comments should be accepted as input, and preserved in output. Defaults to true. -
printWhitespace
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
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
If true, JSON5 trailing commas will be printed in all objects and lists. Has no affect on parsing, and has no effect on output ifprintCommas(boolean)is false. Defaults to false. -
bareSpecialNumerics
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
When printing out a root object, omit the opening and closing braces ( "{}" ). Loading a file generated with this setting requires settingallowBareRootObjectin the builder for the Jankson object that will load them. -
printUnquotedKeys
-
build
Finalizes this JsonGrammar and returns it.
-