Protobuf to JSON
App Development4 posts168 viewsLast activity Sep 2022
AS
asarpeshkarOP
Sep 2022Is the protobuf JSON output produced by applying JsonFormat.Printer to a Daml Value identical to the canonical JSON encoding in the documenation?
CO
cocreature
Sep 2022No they are completely different. The JSON encoding used by the JSON API explicitly exploits type information to simplify the encoding. E.g., parties, contract id and text values are all represented as strings. The protobuf encoding (and therefore also the JSON enoding derived from that) is explicit about which daml-lf value you’re dealing with.
AS
asarpeshkar
Sep 2022In that case, is there a public API to encode a Daml value using the canonical encoding?
CO
cocreature
Sep 2022The library is published to Maven but you are on your own wrt to usage. It’s not intended for external consumption.