JSON-RPC 2.0 provider for .NET Standard / .NET Core
Clone or download



Provides support for serializing and deserializing JSON-RPC 2.0 messages.

NuGet package Gitter

Project Details

  • Supports dynamic response type contracts based on method parameters.
  • Provides limited backward compatibility with the JSON-RPC 1.0 protocol.

Code Examples

var contracts = new JsonRpcContractResolver();
var serializer = new JsonRpcSerializer(contracts);

contracts.AddResponseContract("sum", new JsonRpcResponseContract(typeof(long)));

var request = new JsonRpcRequest("sum", 1L, new[] { 1L, 2L });
var requestString = serializer.SerializeRequest(request);

// [Executing the corresponding HTTP request]

contracts.AddResponseBinding(request.Id, request.Method);

var responseData = serializer.DeserializeResponseData(responseString);
var response = responseData.Item.Message;