# Protobuf to JSON

**URL:** <https://forum.canton.network/t/protobuf-to-json/5204>\
**Category:** App Development\
**Created:** [September 8, 2022, 5:42pm UTC](https://forum.canton.network/t/protobuf-to-json/5204 "2022-09-08T17:42:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![asarpeshkar](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/asarpeshkar/32/1601_2.png) [@asarpeshkar](https://forum.canton.network/u/asarpeshkar)\
**Post date:** [September 8, 2022, 5:42pm UTC](https://forum.canton.network/t/protobuf-to-json/5204/1 "2022-09-08T17:42:50Z")

</div>

Is the protobuf JSON output produced by applying [JsonFormat.Printer](https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/util/JsonFormat.Printer.html) to a Daml [Value](https://docs.daml.com/app-dev/bindings-java/javadocs/com/daml/ledger/api/v1/ValueOuterClass.Value.html) identical to the canonical JSON encoding in the documenation?

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [September 8, 2022, 6:07pm UTC](https://forum.canton.network/t/protobuf-to-json/5204/2 "2022-09-08T18:07:43Z")

</div>

No 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.

---

<div class="post-metadata">

**Author:** ![asarpeshkar](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/asarpeshkar/32/1601_2.png) [@asarpeshkar](https://forum.canton.network/u/asarpeshkar)\
**Post date:** [September 8, 2022, 6:48pm UTC](https://forum.canton.network/t/protobuf-to-json/5204/3 "2022-09-08T18:48:52Z")

</div>

In that case, is there a public API to encode a Daml value using the canonical encoding?

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [September 8, 2022, 6:50pm UTC](https://forum.canton.network/t/protobuf-to-json/5204/4 "2022-09-08T18:50:39Z")

</div>

The library is published to [Maven](https://mvnrepository.com/artifact/com.daml/lf-value-json) but you are on your own wrt to usage. It’s not intended for external consumption.
