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
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
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",{}]]}
thx @cocreature β¦ I was just about to put the solution β¦
This is pretty cumbersome β¦ I understand why by looking at the code but it should really be a first class object in JSON
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.