REST JSON Specification

in Daml-LF JSON Encoding — Daml SDK 1.11.1 documentation, Set is not described in terms of schema.What would the format for a set of party be fore example?

thnx

2 Likes

The reason why Set is not in there is that there is no builtin-type for sets in Daml-LF. Instead DA.Set.Set is a record which wraps Map. You can see the definition here.

So to understand the JSON encoding, you need to combine the encoding for a record and the encoding for Map. daml repl’s :json command is often very useful for this type of stuff and can save you from having to dig through the spec, here’s an example:

daml> import qualified DA.Set as Set
daml> :json Set.fromList ["a", "b", "c"]
{"map":[["a",{}],["b",{}],["c",{}]]}

2 Likes

thx @cocreature … I was just about to put the solution … :slight_smile:

This is pretty cumbersome … I understand why by looking at the code but it should really be a first class object in JSON

1 Like

Hi @Jean_Safar,

Would you mind providing a little bit more context on how you stumbled across this? I would have expected that case to be covered by the codegen and thus to be completely transparent for users.

1 Like