HttpJsonRpc 2.5.2
dotnet add package HttpJsonRpc --version 2.5.2
NuGet\Install-Package HttpJsonRpc -Version 2.5.2
<PackageReference Include="HttpJsonRpc" Version="2.5.2" />
<PackageVersion Include="HttpJsonRpc" Version="2.5.2" />
<PackageReference Include="HttpJsonRpc" />
paket add HttpJsonRpc --version 2.5.2
#r "nuget: HttpJsonRpc, 2.5.2"
#:package HttpJsonRpc@2.5.2
#addin nuget:?package=HttpJsonRpc&version=2.5.2
#tool nuget:?package=HttpJsonRpc&version=2.5.2
HttpJsonRpc
HttpJsonRpc is a cross-platform, .NET Standard library that implements the JSON-RPC 2.0 Specification, as well as streaming (up and down), on top of HTTP.
It makes it simple to create high performance, robust, light-weight API's that can be hosted in any project type. There is no dependency on ASP.NET.
HttpJsonRpc also has extensibility points for logging and dependency injection, so you can use your favorite frameworks.
Getting Started
- Create a class that will hold your
JsonRpcmethods with theJsonRpcClassAttribute.
[JsonRpcClass("math")]
public static class MathApi
{
[JsonRpcMethod]
public static Task<int> SumAsync(int n1, int n2)
{
var result = n1 + n2;
return Task.FromResult(result);
}
}
- Call the
JsonRpc.Startmethod to start listening forJSON-RPCrequests overHTTP.
class Program
{
static void Main(string[] args)
{
JsonRpc.Start();
Console.ReadLine();
}
}
- The ideal way to call
JSON-RPCmethods is using anHTTP POSTwith theJSON-RPC Requestin theHTTP BodybutHttpJsonRpcalso supportsURL Parametersfor simple method calls. Test the method by pasting theURLin a browser.
http://localhost:5000/?method=math.sum&n1=2&n2=2
You should get the result in JSON.
{
"jsonrpc": "2.0",
"result": 4
}
When calling your method in code or Postman use an HTTP POST with the JSON-RPC Request in the HTTP Body.
{
"jsonrpc": "2.0",
"method": "math.sum",
"params": {
"n1": 2,
"n2": 2
},
"id": "1"
}
- You can add your favorite logging provider by setting the
JsonRpc.LoggerFactoryproperty. This sample uses Serilog.
Log.Logger = new LoggerConfiguration()
.WriteTo.Console()
.CreateLogger();
JsonRpc.LoggerFactory = new LoggerFactory().AddSerilog();
JsonRpc.Start();
- You can find more code samples here.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.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 was computed. |
| .NET Framework | net461 was computed. net462 was computed. 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. |
-
.NETStandard 2.0
- CommonServiceLocator (>= 2.0.7)
- Microsoft.AspNetCore.Cors (>= 2.3.0)
- Microsoft.AspNetCore.Server.Kestrel (>= 2.3.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.7)
- System.Text.Json (>= 9.0.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.5.2 | 0 | 12/23/2025 |
| 2.5.1 | 0 | 12/23/2025 |
| 2.5.0 | 0 | 12/23/2025 |
| 2.4.1 | 279 | 8/28/2025 |
| 2.4.0 | 144 | 8/15/2025 |
| 2.3.0 | 208 | 8/4/2025 |
| 2.2.0 | 292 | 9/20/2023 |
| 2.1.1 | 326 | 5/16/2023 |
| 2.1.0 | 309 | 5/16/2023 |
| 2.0.1.4 | 656 | 5/8/2022 |
| 2.0.0.1 | 608 | 5/2/2022 |
| 1.3.9 | 618 | 4/25/2022 |
| 1.3.8 | 855 | 6/25/2020 |
| 1.3.7 | 674 | 4/18/2020 |
| 1.3.6 | 689 | 4/16/2020 |
| 1.3.5 | 692 | 4/16/2020 |
| 1.3.4 | 711 | 4/16/2020 |
| 1.3.3 | 1,027 | 7/29/2019 |
| 1.3.2 | 1,256 | 1/30/2019 |
| 1.3.1 | 1,126 | 1/16/2019 |
| 1.3.0 | 1,111 | 1/6/2019 |
| 1.2.3 | 1,062 | 12/8/2018 |
| 1.2.2 | 1,045 | 12/8/2018 |
| 1.2.1 | 1,105 | 12/8/2018 |
| 1.2.0 | 1,094 | 12/1/2018 |
| 1.1.27 | 1,131 | 11/26/2018 |
| 1.1.26 | 1,161 | 10/18/2018 |
| 1.1.25 | 1,227 | 9/26/2018 |
| 1.1.24 | 1,180 | 9/12/2018 |
| 1.1.23 | 1,163 | 9/11/2018 |
| 1.1.22 | 1,186 | 9/10/2018 |
| 1.1.21 | 1,221 | 9/10/2018 |
| 1.1.20 | 1,223 | 9/10/2018 |
| 1.1.19 | 1,225 | 9/7/2018 |
| 1.1.18 | 1,662 | 7/16/2018 |
| 1.1.17 | 1,591 | 7/8/2018 |
| 1.1.16 | 1,647 | 5/22/2018 |
| 1.1.15 | 1,620 | 5/22/2018 |
| 1.1.14 | 1,577 | 5/22/2018 |
| 1.1.13 | 1,607 | 5/22/2018 |
| 1.1.12 | 1,755 | 5/17/2018 |
| 1.1.11 | 1,766 | 5/17/2018 |
| 1.1.10 | 1,659 | 5/3/2018 |
| 1.1.9 | 1,645 | 5/2/2018 |
| 1.1.8 | 1,692 | 5/2/2018 |
| 1.1.7 | 1,770 | 5/2/2018 |
| 1.1.6 | 1,686 | 4/27/2018 |
| 1.1.5 | 1,738 | 3/19/2018 |
| 1.1.4 | 1,640 | 3/19/2018 |
| 1.1.3 | 1,647 | 3/18/2018 |
| 1.1.2 | 1,646 | 3/15/2018 |
| 1.1.1 | 1,639 | 3/10/2018 |
| 1.1.0 | 1,653 | 3/10/2018 |
| 1.0.25 | 1,673 | 3/9/2018 |
| 1.0.24 | 1,644 | 3/5/2018 |
| 1.0.23 | 1,711 | 12/12/2017 |
| 1.0.22 | 1,973 | 12/11/2017 |
| 1.0.21 | 1,955 | 12/11/2017 |
| 1.0.20 | 1,683 | 12/11/2017 |
| 1.0.19 | 1,878 | 12/11/2017 |
| 1.0.18-beta | 1,234 | 11/28/2017 |
| 1.0.17-beta | 1,213 | 11/10/2017 |
| 1.0.16-beta | 1,241 | 11/9/2017 |
| 1.0.15-beta | 1,251 | 11/9/2017 |
| 1.0.14-beta | 1,280 | 11/9/2017 |
| 1.0.13-beta | 1,236 | 11/8/2017 |
| 1.0.12-beta | 1,252 | 11/8/2017 |
| 1.0.11-beta | 1,237 | 11/8/2017 |
| 1.0.10-beta | 1,253 | 11/6/2017 |
| 1.0.9-beta | 1,254 | 11/5/2017 |
| 1.0.8-beta | 1,256 | 11/4/2017 |
| 1.0.7-beta | 1,282 | 11/4/2017 |
| 1.0.6-beta | 1,294 | 11/4/2017 |
| 1.0.5-beta | 1,253 | 11/4/2017 |
| 1.0.4-beta | 1,228 | 11/3/2017 |
| 1.0.3-beta | 1,206 | 10/31/2017 |
| 1.0.2-beta | 1,241 | 10/31/2017 |
| 1.0.1-beta | 1,267 | 10/29/2017 |
| 1.0.0-beta | 1,270 | 10/28/2017 |