Is it safe to call `decodeString()` and then if it throws an exception attempt to `decodeXXX()` agai...
c
Is it safe to call
decodeString()
and then if it throws an exception attempt to
decodeXXX()
again? I have some data that is sometimes encoded in a String.
e
not across formats, no
c
Ok. Is it safe for JSON?
e
for JSON specifically, decodeJsonElement and then determine if you want to treat it as a String or not
👀 1
🙏 1
1
c
How would go around deserializing some data across formats that is sometimes encoded slightly differently? (and there is no way to tell other than looking at it)
e
unfortunately I think it's going to be format-dependent because not all formats will support that
1
c
I see. Thanks!
e
actually I guess it's only JSON format which has support now, other formats which could support it, currently don't https://github.com/Kotlin/kotlinx.serialization/issues/1573
1
c
I am planning to support that in my own BSON format, we'll see what happens
But mine goes a bit further, it doesn't parse the sub-thing at all until the user explicitly asks for a specific field