mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Merge pull request #6700 from element-hq/feature/bma/lenientJson
Let our Json parser accept comments and trailing comma.
This commit is contained in:
+8
-1
@@ -23,6 +23,13 @@ fun interface JsonProvider {
|
|||||||
@ContributesBinding(AppScope::class)
|
@ContributesBinding(AppScope::class)
|
||||||
@SingleIn(AppScope::class)
|
@SingleIn(AppScope::class)
|
||||||
class DefaultJsonProvider : JsonProvider {
|
class DefaultJsonProvider : JsonProvider {
|
||||||
private val json: Json by lazy { Json { ignoreUnknownKeys = true } }
|
private val json: Json by lazy {
|
||||||
|
Json {
|
||||||
|
ignoreUnknownKeys = true
|
||||||
|
allowComments = true
|
||||||
|
allowTrailingComma = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun invoke() = json
|
override fun invoke() = json
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -80,7 +80,8 @@ class DefaultSessionWellknownRetrieverTest {
|
|||||||
"registration_helper_url": "a_registration_url",
|
"registration_helper_url": "a_registration_url",
|
||||||
"enforce_element_pro": true,
|
"enforce_element_pro": true,
|
||||||
"rageshake_url": "a_rageshake_url",
|
"rageshake_url": "a_rageshake_url",
|
||||||
"other": true
|
// Note the trailing comma, and the comment!
|
||||||
|
"other": true,
|
||||||
}""".trimIndent().toByteArray()
|
}""".trimIndent().toByteArray()
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user