Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zabuzard/prototojson
ProtoToJson is a tool to decode and view binary protobuf messages as readable JSON.
https://github.com/zabuzard/prototojson
gui java json library protobuf
Last synced: 4 days ago
JSON representation
ProtoToJson is a tool to decode and view binary protobuf messages as readable JSON.
- Host: GitHub
- URL: https://github.com/zabuzard/prototojson
- Owner: Zabuzard
- License: gpl-3.0
- Created: 2021-02-01T14:54:33.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-09-22T18:37:28.000Z (over 2 years ago)
- Last Synced: 2024-11-13T04:13:29.639Z (2 months ago)
- Topics: gui, java, json, library, protobuf
- Language: Java
- Homepage:
- Size: 43.9 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ProtoToJson
[![codefactor](https://img.shields.io/codefactor/grade/github/Zabuzard/ProtoToJson)](https://www.codefactor.io/repository/github/zabuzard/prototojson)
[![maven-central](https://img.shields.io/maven-central/v/io.github.zabuzard.prototojson/prototojson)](https://search.maven.org/search?q=g:io.github.zabuzard.prototojson)
[![javadoc](https://javadoc.io/badge2/io.github.zabuzard.prototojson/prototojson/javadoc.svg?style=flat&color=AA82FF)](https://javadoc.io/doc/io.github.zabuzard.prototojson/prototojson)
![Java](https://img.shields.io/badge/Java-11%2B-ff696c)
[![license](https://img.shields.io/github/license/Zabuzard/ProtoToJson)](https://github.com/Zabuzard/ProtoToJson/blob/master/LICENSE)ProtoToJson is a tool to decode and view binary protobuf messages
as readable JSON.It is able to decode any message, provided a descriptor of its
protobuf schema was put into its cache.The tool offers an API as well as a small desktop application.
# Requirements
* Requires at least **Java 11**
# Download
Maven:
```xml
io.github.zabuzard.prototojson
prototojson
1.1```
Jar downloads are available from the [release section](https://github.com/Zabuzard/ProtoToJson/releases).
# Documentation
* [API Javadoc](https://javadoc.io/doc/io.github.zabuzard.prototojson/prototojson)
or alternatively from the [release section](https://github.com/Zabuzard/ProtoToJson/releases)# Descriptor cache
In order to decode protobuf messages, the tool uses protobuf descriptor files
which have to be provided in its cache. The cache for the desktop application is located at
```
%LOCALAPPDATA%\ProtoToJson\descriptorCache
```Such descriptor files `foo.desc` can be obtained by executing
```
protoc --descriptor_set_out foo.desc foo.proto
```
on the protobuf schema `foo.proto`. However, this requires
the [protobuf compiler protoc](https://developers.google.com/protocol-buffers)
to be installed.# Developer API
The module exports the package
```
de.zabuza.prototojson.api;
```
which contains an API `ProtoToJson.java` that can be used as Java library as well.
An example usage could be:
```java
DescriptorCache cache = DescriptorCache.fromDirectory(Path.of("descriptorCache"));
ProtoToJson protoToJson = ProtoToJson.fromCache(cache);String json = protoToJson.toJson(Path.of("someProtoMessage.message"));
```# Desktop application
Upon launch, the application reads its descriptor cache located at
```
%LOCALAPPDATA%\ProtoToJson\descriptorCache
```
If it was started with an argument, the first argument will be interpreted as path
to a binary protobuf message file to decode. Otherwise, the user is prompted to select one.![Select file dialog](https://i.imgur.com/82keZOg.png)
The tool then decodes the message into JSON, provided a corresponding descriptor was found,
and displays the result in a text editor window.![Decoded message](https://i.imgur.com/EcrpK72.png)