v icon indicating copy to clipboard operation
v copied to clipboard

Implement JSON-RPC Module in V Standard Library

Open kbkpbot opened this issue 1 month ago • 4 comments

Describe the feature

Propose adding a comprehensive JSON-RPC 2.0 implementation to V's standard library as a standalone module at vlib/jsonrpc.

Use Case

JSON-RPC is a lightweight remote procedure call protocol that is widely used in:

  • Language Server Protocol (LSP) implementations
  • Blockchain and cryptocurrency APIs (Ethereum, Bitcoin)
  • Microservices communication
  • IoT device management
  • AI/ML tooling (Model Context Protocol, OpenAI APIs)

Currently, V lacks a standardized way to handle JSON-RPC, forcing developers to implement protocol logic repeatedly. A standard implementation would:

  • Enable better tooling (language servers, debug adapters)
  • Facilitate integration with existing JSON-RPC-based services
  • Provide foundation for higher-level protocols (like MCP)
  • Reduce boilerplate in networked applications

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • [ ] I may be able to implement this feature request
  • [ ] This feature might incur a breaking change

Version used

V 0.4.12 33e129b19e1124bb0cb6b057ee04324cc25409b4

Environment details (OS name and version, etc.)

V full version V 0.4.12 33e129b19e1124bb0cb6b057ee04324cc25409b4
OS linux, Ubuntu 20.04.6 LTS
Processor 4 cpus, 64bit, little endian, aarch64
Memory 1.65GB/3.78GB
V executable /home/vpn/github/lang/v/v
V last modified time 2025-11-10 02:28:38
V home dir OK, value: /home/vpn/github/lang/v
VMODULES OK, value: /home/vpn/.vmodules
VTMP OK, value: /tmp/v_1001
Current working dir OK, value: /home/vpn/github/lang/v/vlib
Git version git version 2.25.1
V git status weekly.2025.45-35-g33e129b1
.git/config present true
cc version cc (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0
gcc version gcc (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0
clang version clang version 10.0.0-4ubuntu1
tcc version tcc version 0.9.27 mob:da11cf6 (AArch64 Linux)
tcc git status thirdparty-linux-aarch64 ecc2f67a
emcc version N/A
glibc version ldd (Ubuntu GLIBC 2.31-0ubuntu9.18) 2.31

[!NOTE] You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote. Other reactions and those to comments will not be taken into account.

kbkpbot avatar Nov 10 '25 03:11 kbkpbot

Afaik the old VLS had a jsonrpc module in https://github.com/vlang/vls/tree/old_vls/jsonrpc . I have not reviewed it for completeness, but perhaps it could be used as is?

spytheman avatar Nov 13 '25 09:11 spytheman

https://github.com/vlang/v-analyzer/tree/main/src/jsonrpc seems to have a more recent version of the same module.

spytheman avatar Nov 13 '25 09:11 spytheman

jsonrpc should be provided as a standard library of v

Avey777 avatar Nov 13 '25 12:11 Avey777

jsonrpc should be provided as a standard library of v

I believe this should be a package instead.

Delta456 avatar Nov 18 '25 14:11 Delta456