aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/Firmament.kt7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/kotlin/Firmament.kt b/src/main/kotlin/Firmament.kt
index e89fc99..717808f 100644
--- a/src/main/kotlin/Firmament.kt
+++ b/src/main/kotlin/Firmament.kt
@@ -66,6 +66,8 @@ object Firmament {
}
val version: Version by lazy { metadata.version }
+ private val DEFAULT_JSON_INDENT = " "
+
@OptIn(ExperimentalSerializationApi::class)
val json = Json {
prettyPrint = DEBUG
@@ -73,20 +75,21 @@ object Firmament {
allowTrailingComma = true
ignoreUnknownKeys = true
encodeDefaults = true
- prettyPrintIndent = "\t"
+ prettyPrintIndent = if (prettyPrint) "\t" else DEFAULT_JSON_INDENT
}
/**
* FUCK two space indentation
*/
val twoSpaceJson = Json(from = json) {
+ prettyPrint = true
prettyPrintIndent = " "
}
val gson = Gson()
val tightJson = Json(from = json) {
prettyPrint = false
// Reset pretty print indent back to default to prevent getting yelled at by json
- prettyPrintIndent = " "
+ prettyPrintIndent = DEFAULT_JSON_INDENT
encodeDefaults = false
explicitNulls = false
}