Search in sources :

Example 1 with JsonFormat

use of com.googlecode.protobuf.format.JsonFormat in project tutorials by eugenp.

the class ApplicationIntegrationTest method convertProtobufMessageStreamToJsonString.

private String convertProtobufMessageStreamToJsonString(InputStream protobufStream) throws IOException {
    JsonFormat jsonFormat = new JsonFormat();
    Course course = Course.parseFrom(protobufStream);
    return jsonFormat.printToString(course);
}
Also used : JsonFormat(com.googlecode.protobuf.format.JsonFormat) Course(com.baeldung.protobuf.BaeldungTraining.Course)

Aggregations

Course (com.baeldung.protobuf.BaeldungTraining.Course)1 JsonFormat (com.googlecode.protobuf.format.JsonFormat)1