Representing a collection with enumerated keys

I need to represent a collection of monetary values in json and preferably have this indexed by currency code like so

  {
    "data": {
      "price" : {
        "USD" : {"value": 9.99},
        "GBP" : { "value" : 6.99}
      }
    }
  }

So the question is how to represent such an object…

it must have properties that conform to an enumerated list (currency codes) - possiby allow custom codes so maybe a stipulation of 3 characters is sufficient.
Each property must have value of {“value”: float}

Any ideas on how to approch this would be welcome.

Trying to provide jsonapi documentation in stoplight

1 Like