How to deserialise and serialise com.daml.ledger.javaapi.data.Record object
- Ravi_BhupataniOP 1
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 - stefanobaghino-da 1
One note before addressing your question:
Recordhas been recently deprecated in favor of the identicalDamlRecordto avoid clashing with the recently introduced built-injava.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.dataare 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 invoketoProtoon the object of typeRecordand then feed it into theXmlFormatter.