@Test
fun testSerialization(){
var str = "{\"str\":\"\\'\"}"
var json = Json{
isLenient = true
ignoreUnknownKeys = true
}
var gson = Gson()
var gsonObj = gson.fromJson(str, TestClass::class.java)
var korLibsObj = KorLibsJson.parse(str)
var kotlinxObj = json.decodeFromString<TestClass>(str)
}
@Serializable
class TestClass(var str: String)
Getting error when parsing a string containing single quote in escaped form. Gson and Korlib's serialization libraries are able to handle this case. Am I missing any JsonConfiguration options ?
e
ephemient
08/22/2024, 4:17 PM
pretty sure that's not allowed by the json spec
ephemient
08/22/2024, 4:17 PM
if you already tried
Json { isLenient = true }
and that doesn't work then no, you're not missing anything
c
Charann
08/22/2024, 4:20 PM
@ephemient "pretty sure that's not allowed by the json spec" Sorry but didn't get this Could you please elaborate on this?