Skip to content
Discussions/App Development/REST JSON SpecificationForum ↗

REST JSON Specification

App Development4 posts696 views6 likesLast activity Apr 2021
JE
Jean_SafarOP
Apr 2021

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

CO
cocreature
Apr 2021

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",{}]]}

JE
Jean_Safar
Apr 2021

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

GA
Gary_Verhaegen
Apr 2021

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.

← Back to Discussions