ProtoBufJsonConverter 0.0.3
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package ProtoBufJsonConverter --version 0.0.3
NuGet\Install-Package ProtoBufJsonConverter -Version 0.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ProtoBufJsonConverter" Version="0.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ProtoBufJsonConverter --version 0.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ProtoBufJsonConverter, 0.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ProtoBufJsonConverter as a Cake Addin
#addin nuget:?package=ProtoBufJsonConverter&version=0.0.3
// Install ProtoBufJsonConverter as a Cake Tool
#tool nuget:?package=ProtoBufJsonConverter&version=0.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ProtoBufJsonConverter
This project uses protobuf-net to:
- Convert a protobuf message to a JSON string using the proto definition file.
- Convert a protobuf message to an object using the proto definition file.
- Convert a JSON string to a protobuf message using the proto definition file.
Usage
Proto Definition
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;
}
1️⃣ Convert ProtoBuf byte[]
to a JSON string
Code
var protoDefinition = "...". // See above
var bytes = Convert.FromBase64String("CgRzdGVm");
var convertToJsonRequest = new ConvertToJsonRequest(protoDefinition, "greet.Greeter.SayHello", bytes);
var converter = new Converter();
var json = converter.ConvertToJson(convertToJsonRequest);
JSON
{"name":"stef"}
1️⃣ Convert ProtoBuf byte[]
to an object
Code
var protoDefinition = "...". // See above
var bytes = Convert.FromBase64String("CgRzdGVm");
var convertToObjectRequest = new ConvertToObjectRequest(protoDefinition, "greet.Greeter.SayHello", bytes);
var converter = new Converter();
var @object = converter.ConvertToJson(convertToObjectRequest);
3️⃣ Convert JSON string
to a ProtoBuf byte[]
Code
var protoDefinition = "...". // See above
var json = @"{""name"":""stef""}";
var convertToProtoBufRequest = new ConvertToProtoBufRequest(protoDefinition, "greet.Greeter.SayHello", json);
var converter = new Converter();
var protobuf = converter.ConvertToProtoBuf(convertToProtoBufRequest);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.6.2
- AnyOf (>= 0.3.0)
- JsonConverter.Newtonsoft.Json (>= 0.5.0)
- Microsoft.CodeAnalysis.CSharp (>= 4.8.0)
- protobuf-net (>= 3.2.30)
- protobuf-net.Reflection (>= 3.2.12)
- Stef.Validation (>= 0.1.1)
-
.NETStandard 2.0
- AnyOf (>= 0.3.0)
- JsonConverter.Newtonsoft.Json (>= 0.5.0)
- Microsoft.CodeAnalysis.CSharp (>= 4.8.0)
- protobuf-net (>= 3.2.30)
- protobuf-net.Reflection (>= 3.2.12)
- Stef.Validation (>= 0.1.1)
-
.NETStandard 2.1
- AnyOf (>= 0.3.0)
- JsonConverter.Newtonsoft.Json (>= 0.5.0)
- Microsoft.CodeAnalysis.CSharp (>= 4.8.0)
- protobuf-net (>= 3.2.30)
- protobuf-net.Reflection (>= 3.2.12)
- Stef.Validation (>= 0.1.1)
-
net6.0
- AnyOf (>= 0.3.0)
- JsonConverter.Newtonsoft.Json (>= 0.5.0)
- Microsoft.CodeAnalysis.CSharp (>= 4.8.0)
- protobuf-net (>= 3.2.30)
- protobuf-net.Reflection (>= 3.2.12)
- Stef.Validation (>= 0.1.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ProtoBufJsonConverter:
Package | Downloads |
---|---|
WireMock.Net
Lightweight Http Mocking Server for .Net, inspired by WireMock from the Java landscape. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.3.0 | 303,943 | 3/6/2024 |
0.2.0 | 107,514 | 2/9/2024 |
0.2.0-preview-04 | 99 | 1/31/2024 |
0.2.0-preview-03 | 68 | 1/27/2024 |
0.2.0-preview-01 | 62 | 1/25/2024 |
0.1.0 | 202 | 1/6/2024 |
0.0.6 | 293 | 12/28/2023 |
0.0.5 | 152 | 12/27/2023 |
0.0.4 | 154 | 12/25/2023 |
0.0.3 | 151 | 12/23/2023 |
0.0.2 | 117 | 12/22/2023 |
See CHANGELOG.md