back to listing index

protobuf-java-format - Serialization support for Google's protobuf Message for Java based clients - Google Project Hosting

[web search]
Original source (code.google.com)
Tags: java json library protobuf
Clipped on: 2015-10-07

Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Project Information

Description

Provide serialization and de-serialization of different formats based on Google’s protobuf Message. Enables overriding the default (byte array) output to text based formats such as XML, JSON and HTML.

Example

For XML output, use XmlFormat

Message someProto = SomeProto.getDefaultInstance();
String xmlFormat = XmlFormat.printToString(someProto);

For XML input, use XmlFormat

Message.Builder builder = SomeProto.newBuilder();
String xmlFormat = _load xml document from a source_;
XmlFormat.merge(xmlFormat, builder);

For Json output, use JsonFormat

Message someProto = SomeProto.getDefaultInstance();
String jsonFormat = JsonFormat.printToString(someProto);

For Json input, use JsonFormat

Message.Builder builder = SomeProto.newBuilder();
String jsonFormat = _load json document from a source_;
JsonFormat.merge(jsonFormat, builder);

For HTML output, use HtmlFormat

Message someProto = SomeProto.getDefaultInstance();
String htmlFormat = HtmlFormat.printToString(someProto);

What's next?

  1. Smile format Spec
  2. Support de-serialization for HTML/xHTML
  3. Add Support for RSS/Atom
  4. Add Support for YAML
  5. Additional output types?