-
Notifications
You must be signed in to change notification settings - Fork 76
Description
Is your feature request related to a problem? Please describe.
Currently, encoding and decoding a map[string]any results in a map[any]any. This is incompatible with JSON.
A clear and concise description of what the problem is.
I'm using JSON for may app, but CBOR for storage, as it's more compact. Users can submit any kind of JSON data through the API, including objects, which encoding/json marshals into map[string]any. A lot of JSON-based tooling expects JSON objects to be decoded in this way, e.g., jsonpath.
I gather that the CBOR standard allows any type of hashable value to be an object key, so when cbor decodes an encoded object, it creates a map[any]any. This is incompatible with JSON tooling that only recognizes map[string]any.
Describe the solution you'd like
A clear and concise description of what you want to happen.
I'd like some sort of configuration to tell cbor to use map[string]any instead of map[any]any when decoding objects.
May be similar or related to #439 and #441.
Describe alternatives you've considered
In my app, I can't pre-create a map, because the data is user-submitted, so might not be a map, and even if it was would almost certainly have texted map[string]any objects.
Thanks!