Non-string map keys #376
-
Perhaps I've missed something in the documentation, but it's not clear whether non-string map keys are supported via the cursor interface when decoding CBOR or Msgpack. The same goes with I don't actually need non-string key support right now; I was just curious if it was indeed supported. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
It's supported at the lowest levels. At the lowest levels, keys can be any value, including object and array. Specifically, the push parsers Currently our pull readers,
|
Beta Was this translation helpful? Give feedback.
-
It turns out I need Unfortunately, |
Beta Was this translation helpful? Give feedback.
It's supported at the lowest levels. At the lowest levels, keys can be any value, including object and array. Specifically, the push parsers
basic_cbor_parser
andbasic_msgpack_parser
write parse events to abasic_json_visitor2
, which receives key-value pairs as a pair of values rather than a key and a value. Higher levels, though, use an adaptor to adapt thebasic_json_visitor2
to abasic_json_visitor
for parsing. The adaptor receives object members as a pair of values, serializing the first value to a string, and outputs them as a string key and a value. So currently, if you needed the non-stringified key, you would need to work at the level ofbasic_json_visitor2
.Currently our pull re…