msgpack icon indicating copy to clipboard operation
msgpack copied to clipboard

Decoding nested map with integer keys

Open rikvdh opened this issue 3 years ago • 0 comments

For my use-case I use nested maps with integers as keys (instead of strings as usual). For example this:

[129 5 133 0 169 49 50 55 46 48 46 48 46 49 1 165 58 51 51 51 52 64 203 63 185 153 153 153 153 153 154 65 203 63 185 153 153 153 153 153 154 66 1]

This is something encoded by this library. But I can't seem to decode this.

Expected Behavior

Decode without errors.

Current Behavior

msgpack: invalid code=0 decoding string/bytes length

Possible Solution

I don't know. I've tried 'SetMapDecoder' with UntypedMap, but this doesn't work as well.

Steps to Reproduce

https://play.golang.org/p/nOhguZK1vJo or https://play.golang.org/p/2RR-CfGQUAu

It appears that the sub-map (starting at the third byte) is decoded as a map[string]interface{}.

rikvdh avatar Jun 30 '21 10:06 rikvdh