![]() |
VOOZH | about |
dotnet add package ProtoBufJsonConverter --version 0.11.0
NuGet\Install-Package ProtoBufJsonConverter -Version 0.11.0
<PackageReference Include="ProtoBufJsonConverter" Version="0.11.0" />
<PackageVersion Include="ProtoBufJsonConverter" Version="0.11.0" />Directory.Packages.props
<PackageReference Include="ProtoBufJsonConverter" />Project file
paket add ProtoBufJsonConverter --version 0.11.0
#r "nuget: ProtoBufJsonConverter, 0.11.0"
#:package ProtoBufJsonConverter@0.11.0
#addin nuget:?package=ProtoBufJsonConverter&version=0.11.0Install as a Cake Addin
#tool nuget:?package=ProtoBufJsonConverter&version=0.11.0Install as a Cake Tool
syntax = "proto3";
// Package name
package greet;
// The greeting service definition.
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply);
}
// The request message containing the user's name.
message HelloRequest {
string name = 1;
}
// The response message containing the greetings
message HelloReply {
string message = 1;
}
byte[] to a JSON stringvar protoDefinition = "...". // See above
var bytes = Convert.FromBase64String("CgRzdGVm");
var request = new ConvertToJsonRequest(protoDefinition, "greet.HelloRequest", bytes);
var converter = new Converter();
var json = await converter.ConvertAsync(request);
{"name":"stef"}
byte[] to an objectvar protoDefinition = "...". // See above
var bytes = Convert.FromBase64String("CgRzdGVm");
var request = new ConvertToObjectRequest(protoDefinition, "greet.HelloRequest", bytes);
var converter = new Converter();
var @object = await converter.ConvertAsync(request);
string to a ProtoBuf byte[]var protoDefinition = "...". // See above
var json = @"{""name"":""stef""}";
var request = new ConvertToProtoBufRequest(protoDefinition, "greet.HelloRequest", json);
var converter = new Converter();
var protobuf = await converter.ConvertAsync(request);
object to a ProtoBuf byte[]var protoDefinition = "...". // See above
var obj = new
{
name = "stef"
};
var request = new ConvertToProtoBufRequest(protoDefinition, "greet.HelloRequest", obj);
var converter = new Converter();
var protobuf = await converter.ConvertAsync(request);
object to a ProtoBuf byte[] including the Grpc Headervar protoDefinition = "...". // See above
var obj = new
{
name = "stef"
};
var request = new ConvertToProtoBufRequest(protoDefinition, "greet.HelloRequest", obj)
.WithGrpcHeader();
var converter = new Converter();
var protobufWithGrpcHeader = await ConvertAsync.Convert(request);
In order to use this library in a Blazor WebAssembly application, you need to provide a specific Blazor implementation for the IMetadataReferenceService, the BlazorWasmMetadataReferenceService.
byte[] to a JSON stringpublic class Program
{
public static async Task Main(string[] args)
{
// ...
// Add AddSingleton registrations for the IMetadataReferenceService and IConverter
builder.Services.AddSingleton<IMetadataReferenceService, BlazorWasmMetadataReferenceService>();
builder.Services.AddSingleton<IConverter, Converter>();
await builder.Build().RunAsync();
}
}
public partial class Home
{
[Inject]
public required IConverter Converter { get; set; }
private State _state = State.None;
private string _protoDefinition = "..."; // See above
private string _messageType = "greet.HelloRequest";
private ConvertType _selectedConvertType = ConvertType.ToJson;
private string _protobufAsBase64 = "CgRzdGVm";
private bool _skipGrpcHeader = true;
private bool _addGrpcHeader = true;
private string _json = string.Empty;
private async Task OnClick()
{
await ConvertToJsonAsync();
}
private async Task ConvertToJsonAsync()
{
_json = string.Empty;
var bytes = Convert.FromBase64String(_protobufAsBase64);
var convertToJsonRequest = new ConvertToJsonRequest(_protoDefinition, _messageType, bytes)
.WithSkipGrpcHeader(_skipGrpcHeader)
.WithWriteIndented();
_json = await Converter.ConvertAsync(convertToJsonRequest);
}
}
For a full example, see examples/ProtoBufJsonConverter.Blazor.
var protoDefinition = "...". // See above
var request = new GetInformationRequest(protoDefinition);
var response = await _sut.GetInformationAsync(request);
var packageNames = response.PackageNames;
var messageTypes = response.MessageTypes;
var namespaces = response.CSharpNamespaces;
Entity Framework Extensions and Dapper Plus are major sponsors and proud to contribute to the development of ProtoBufJsonConverter.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 is compatible. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 2 NuGet packages that depend on ProtoBufJsonConverter:
| Package | Downloads |
|---|---|
|
WireMock.Net.ProtoBuf
ProtoBuf and gRPC support for WireMock.Net |
|
|
VerticalField.VFS.MqttManager
Package Description |
Showing the top 1 popular GitHub repositories that depend on ProtoBufJsonConverter:
| Repository | Stars |
|---|---|
|
wiremock/WireMock.Net
WireMock.Net is a flexible product for stubbing and mocking web HTTP responses using advanced request matching and response templating. Based on WireMock Java, but extended and different functionality. Full documentation can be found at https://wiremock.org/dotnet/.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 0.11.0 | 3,410,370 | 12/24/2025 |
| 0.10.0.1 | 10,549 | 6/15/2025 |
| 0.10.0 | 4,844,190 | 5/18/2025 |
| 0.9.0 | 258,041 | 5/10/2025 |
| 0.8.0 | 271,166 | 5/5/2025 |
| 0.8.0-preview-01 | 268 | 5/4/2025 |
| 0.7.0 | 3,884,181 | 1/8/2025 |
| 0.7.0-preview-02 | 283 | 1/6/2025 |
| 0.7.0-preview-01 | 238 | 1/6/2025 |
| 0.6.0 | 509 | 1/3/2025 |
| 0.6.0-preview-03 | 287 | 1/3/2025 |
| 0.6.0-preview-02 | 275 | 1/3/2025 |
| 0.6.0-preview-01 | 266 | 1/2/2025 |
| 0.5.0 | 2,703,477 | 10/17/2024 |
| 0.4.0 | 314 | 10/15/2024 |
See CHANGELOG.md