Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/How to deserialise and serialise com.daml.ledger.javaapi.data.Record objectForum ↗

How to deserialise and serialise com.daml.ledger.javaapi.data.Record object

App Development2 posts172 views2 likesLast activity Oct 2021
RA
Ravi_BhupataniOP
Oct 2021

Hi,

I have a usecase where in we are persisting the incoming record objects objects over gRPC into XML format using protobuf XmlFormatter utility class.
However, I am not sure how can I deserialize XML back to Record object using XmlFormatter.merge method.
I guess I’d need a builder for Record object.
May I please request any guidance / help on this?

Thanks
Ravi

ST
stefanobaghino-da
Oct 2021

One note before addressing your question: Record has been recently deprecated in favor of the identical DamlRecord to avoid clashing with the recently introduced built-in java.lang.Record (see the release notes for Daml 1.15.0).

To your question, all the classes provided as part of com.daml.ledger.javaapi.data are not Protobuf-based, but rather convenience data classes for developers to use alongside our bindings that provide a more idiomatic experience when building Java applications that interact with the ledger. However, what they do is providing you the infrastructure to convert objects of this type to and from Protobuf. What you could do is invoke toProto on the object of type Record and then feed it into the XmlFormatter.

← Back to Discussions