Gathering detailed insights and metrics for jsonrpc-lite
Gathering detailed insights and metrics for jsonrpc-lite
Gathering detailed insights and metrics for jsonrpc-lite
Gathering detailed insights and metrics for jsonrpc-lite
Parse and Serialize JSON-RPC2 messages in node.js, or browser.
npm install jsonrpc-lite
Typescript
Module System
Node Version
NPM Version
99.9
Supply Chain
100
Quality
75.8
Maintenance
100
Vulnerability
100
License
JavaScript (56.73%)
TypeScript (43.27%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
95 Stars
46 Commits
13 Forks
3 Watchers
3 Branches
12 Contributors
Updated on Feb 24, 2025
Minified
Minified + Gzipped
Latest Version
2.2.0
Package Id
jsonrpc-lite@2.2.0
Size
13.85 kB
NPM Version
6.13.4
Node Version
12.15.0
Published on
Sep 02, 2020
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
6
Parse and Serialize JSON-RPC2 messages in node.js or browser.
Inspired by https://github.com/soggie/jsonrpc-serializer
A implementation of JSON-RPC 2.0 specifications
1npm install jsonrpc-lite
1const jsonrpc = require('jsonrpc-lite')
Creates a JSON-RPC 2.0 request object, return JsonRpc object.
id
: {String|Integer}method
: {String}params
: {Object|Array}, optional1const requestObj = jsonrpc.request('123', 'update', {list: [1, 2, 3]}) 2// { 3// jsonrpc: '2.0', 4// id: '123', 5// method: 'update', 6// params: {list: [1, 2, 3]} 7// }
Creates a JSON-RPC 2.0 notification object, return JsonRpc object.
method
: {String}params
: {Object|Array}, optional1const notificationObj = jsonrpc.notification('update', {list: [1, 2, 3]}) 2// { 3// jsonrpc: '2.0', 4// method: 'update', 5// params: {list: [1, 2, 3]} 6// }
Creates a JSON-RPC 2.0 success response object, return JsonRpc object.
id
: {String|Integer}result
: {Mixed}1const successObj = jsonrpc.success('123', 'OK') 2// { 3// jsonrpc: '2.0', 4// id: '123', 5// result: 'OK', 6// }
Creates a JSON-RPC 2.0 error response object, return JsonRpc object.
id
: {String|Integer}error
: {JsonRpcError}1const errorObj = jsonrpc.error('123', new jsonrpc.JsonRpcError('some error', 99)) 2// { 3// jsonrpc: '2.0', 4// id: '123', 5// error: {code: 99, 'message': 'some error'}, 6// }
Takes a JSON-RPC 2.0 payload (string) and tries to parse it into a JSON. If successful, determine what object is it (response, notification, success, error, or invalid), and return it's type and properly formatted object.
message
: {String}return an array, or an object of this format:
single parsed request:
1{ 2 type: 'request', 3 payload: { 4 jsonrpc: '2.0', 5 id: 123, 6 method: 'update', 7 params: {} 8 } 9}
batch parsed result:
1[{ 2 type: 'request', 3 payload: { 4 jsonrpc: '2.0', 5 id: '123', 6 method: 'update', 7 params: [1, 2, 3] 8 } 9}, { 10 type: 'notification', 11 payload: { 12 jsonrpc: '2.0', 13 method: 'update', 14 params: {_id: 'xxx'} 15 } 16}, { 17 type: 'success', 18 payload: { 19 jsonrpc: '2.0', 20 id: '123', 21 result: 'OK' 22 } 23}, { 24 type: 'error', 25 payload: { 26 jsonrpc: '2.0', 27 id: '123', 28 error: [jsonrpc.JsonRpcError object] 29 } 30}, { 31 type: 'invalid', 32 payload: [jsonrpc.JsonRpcError object] 33}]
Takes a JSON-RPC 2.0 payload (Object) and tries to parse it into a JSON. If successful, determine what object is it (response, notification, success, error, or invalid), and return it's type and properly formatted object.
message
: {Object}return an JsonRpcParsed
object with type
and payload
.
Create a JsonRpcError instance.
message
: {String}code
: {Integer}data
: {Mixed} optional1const error = new jsonrpc.JsonRpcError('some error', 999)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
5 existing vulnerabilities detected
Details
Reason
Found 4/17 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More