gitwtfhub

wtf is jsonrpc?

kelseyhightower/jsonrpc — explained in plain English

Analysis updated 2026-07-17 · repo last pushed 2019-10-05

18GoAudience · developerComplexity · 2/5DormantSetup · easy

TL;DR

A tiny Go package that turns any Go function into a callable web service using the JSON-RPC protocol, without building a full REST API.

Mindmap

mindmap
  root((repo))
    What it does
      Exposes Go functions
      JSON-RPC over HTTP
      No routes needed
    Tech stack
      Go
      JSON-RPC
      HTTP
    Use cases
      Expose calculation logic
      Callable service from any language
      Lightweight service bridge
    Audience
      Go developers
      Backend engineers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Expose an existing Go function like a shipping-cost calculator as a callable web service

REASON 2

Let non-Go clients call your Go logic over plain HTTP with JSON

REASON 3

Build a minimal service without setting up a full REST API framework

What's in the stack?

GoJSON-RPCHTTP

How it stacks up

kelseyhightower/jsonrpcgacjie/agent_flowh0i5/ipl
Stars181818
LanguageGoGoGo
Last pushed2019-10-05
MaintenanceDormant
Setup difficultyeasyeasyeasy
Complexity2/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 5min

Minimal by design, no authentication, logging, or error handling built in for production use.

No license information is available in the explanation.

Wtf does this do

jsonrpc is a small Go package that lets you turn ordinary Go functions into web services that other programs can call over the internet. Instead of building a full web API with routes and handlers, you register your function once and this package handles the communication layer automatically. The package uses JSON-RPC, a simple protocol where a caller sends a JSON request containing a method name, some parameters, and a request ID. The server runs the matching function and sends back a JSON response with the result. In the example provided, a Multiply function that takes two numbers gets registered, and anyone can call it by sending an HTTP request with the method name Arith.Multiply and the numbers to use. The response comes back as plain JSON with the answer. This would be useful for a Go developer who wants to expose some logic as a callable service without setting up a full REST API. For example, if you have a function that calculates shipping costs or processes a data file, you could make it available to other applications with just a few lines of code. The caller doesn't need to be written in Go, anything that can send an HTTP request with JSON will work. What's notable is how minimal the approach is. The entire package is essentially a bridge between Go's built-in RPC system and standard HTTP, using JSON as the format. There's no framework, no configuration files, and no overhead beyond what Go already provides. The README doesn't go into detail beyond the example, so it's best suited for straightforward use cases rather than complex production services that might need authentication, logging, or error handling built in.

Yoink these prompts

Prompt 1
Register my own Go function with this jsonrpc package and show me how to call it over HTTP.
Prompt 2
Explain how the Multiply example maps to a JSON-RPC request and response in this package.
Prompt 3
How would I call this Go JSON-RPC service from a non-Go client using just HTTP and JSON?
Prompt 4
What would I need to add to make this package production-ready with authentication and logging?

Frequently asked questions

wtf is jsonrpc?

A tiny Go package that turns any Go function into a callable web service using the JSON-RPC protocol, without building a full REST API.

What language is jsonrpc written in?

Mainly Go. The stack also includes Go, JSON-RPC, HTTP.

Is jsonrpc actively maintained?

Dormant — no commits in 2+ years (last push 2019-10-05).

What license does jsonrpc use?

No license information is available in the explanation.

How hard is jsonrpc to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is jsonrpc for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.