question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

kotlinx.serialization.cbor.CborDecodingException: Expected byte bf, but found a2

See original GitHub issue

Describe the bug Can’t deserialize data serialized with https://github.com/peteroupc/CBOR-Java on a server side. Got the following exception: kotlinx.serialization.cbor.CborDecodingException: Expected byte bf, but found a2

To Reproduce

val test = SomeClass()
test.prop = 99
var bytes = CBORObject.FromObject(test).EncodeToBytes()
Cbor.load<SomeClass>(bytes)

Expected behavior Should just work. It works well on iOS side when deserializing using this lib https://github.com/myfreeweb/SwiftCBOR. So I post here instead of CBOR-Java repo.

Environment

  • Kotlin version: 1.3.41
  • Library version: 0.11.1
  • Kotlin platforms: JVM

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
slipdefcommented, Jul 17, 2019
@Serializable
class SomeClass {
    public var prop: Int = 0
}
0reactions
slipdefcommented, Aug 23, 2019

Thanks, looking forward for new kotlinx.serialization release. It’s quite a pain to build it from sources now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

kotlinx.serialization.cbor.CborDecodingException: Expected ...
I found a way by myself, the errors was two basically: the override val descriptor: SerialDescriptor variable was setted to recognize String ...
Read more >
What is wrong w this CBOR code 1 0 0 RC kotlin ver 1 4 10 Th
kotlinx.serialization.cbor.internal.CborDecodingException: Expected start of array, but found BF @Serializable sealed class BaseClass() @Serializable data ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found