aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-06-18 01:00:40 +0200
committerLinnea Gräf <nea@nea.moe>2025-06-18 01:00:40 +0200
commit79939812a1b963ced7f9ffc090be4cc607f6b09d (patch)
tree4b1da4e9500cd82c23cf2b9461358b9a21a01e9b /src
parentb79d137a7d47bf8bcb4fb2062f097f8f41da2b65 (diff)
downloadFirmament-79939812a1b963ced7f9ffc090be4cc607f6b09d.tar.gz
Firmament-79939812a1b963ced7f9ffc090be4cc607f6b09d.tar.bz2
Firmament-79939812a1b963ced7f9ffc090be4cc607f6b09d.zip
fix: json pretty printing rules causing issues
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
}