REST JSON Specification

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