MCPcopy Index your code
hub / github.com/brillout/json-serializer

github.com/brillout/json-serializer @v0.5.25

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.5.25 ↗ · + Follow
32 symbols 99 edges 24 files 1 documented · 3% 1 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

@brillout/json-serializer

Same as JSON but with added support for: - Date - undefined - Set - Map - BigInt - RegExp - NaN - Infinity

JSON is a good serializer for JavaScript values but is lacking some JavaScript types such as Date:

!INLINE /examples/date_json.js --hide-source-path

Whereas with @brillout/json-serializer:

!INLINE /examples/date_json-serializer.js --hide-source-path

Contents

Usage

!INLINE /examples/simple.js --hide-source-path

Full Example

Example exposing all differences between JSON and @brillout/json-serializer.

!INLINE /examples/json-serializer.js

To run the example:

$ git clone git@github.com:brillout/json-serializer
$ cd json-serializer
$ npm install
$ npm run self-link
$ node ./examples/json-serializer.js

The npm run self-link is required to be able to self require('@brillout/json-serializer').

How it Works

Let's see how @brillout/json-serializer serializes an object:

!INLINE /examples/inspect.js

@brillout/json-serializer is based on JSON while using prefixed strings for unsupported types.

@brillout/json-serializer uses the native JSON.parse and JSON.stringify functions while modifying the serialization of unsupported types.

Core symbols most depended-on inside this repo

stringify
called by 57
src/stringify.ts
parse
called by 39
src/parse.ts
ts
called by 10
src/types.ts
serializer
called by 4
src/stringify.ts
parser
called by 3
src/parse.ts
genErr
called by 2
src/stringify.ts
getPathString
called by 2
src/stringify.ts
isKeyDotNotationCompatible
called by 2
src/stringify.ts

Shape

Function 29
Class 2
Method 1

Languages

TypeScript100%

Modules by API surface

src/stringify.ts9 symbols
test/main.spec.ts5 symbols
test/error-handling.spec.js5 symbols
src/parse.ts4 symbols
src/utils/addPathToReplacer.ts3 symbols
src/utils/isReactElement.ts1 symbols
src/utils/isObject.ts1 symbols
src/utils/isCallable.ts1 symbols
src/types.ts1 symbols
examples/test.js1 symbols
examples.js1 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add json-serializer \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page