#Deserializing when there is an arbitrary number of keys

4 messages · Page 1 of 1 (latest)

shadow cipher
#

One part of the json I'm receiving has a section like this:

 "releases": {
    "0.1": [
      {
        ...
      }
    "0.2": [
      {
        ...
      }

There are an arbitrary number of "0.x" keys, each containing a similar list. Right now I just use serde Value, but I'd like to get it as a type. Should I create a custom deserializer for this or is there any easier way?

cedar gyro
#

you could deserialize into a hashmap for example

#

where the "0.x" is the hashmap key and the array is the value

cedar gyro
#

(custom deserializer is not needed. just have a field called releases that is a hashmap)