https://github.com/lawrence-laz/jaysan
A fast json serializer
https://github.com/lawrence-laz/jaysan
json json-serializer zig zig-package
Last synced: 12 months ago
JSON representation
A fast json serializer
- Host: GitHub
- URL: https://github.com/lawrence-laz/jaysan
- Owner: lawrence-laz
- License: mit
- Created: 2024-09-18T23:20:56.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-22T22:42:49.000Z (over 1 year ago)
- Last Synced: 2025-04-13T05:53:08.919Z (about 1 year ago)
- Topics: json, json-serializer, zig, zig-package
- Language: Zig
- Homepage:
- Size: 25.4 KB
- Stars: 11
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

Jayさん
Jaysan is a fast json library written in Zig. Currently supports serialization only.
```zig
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const Foo = struct {
foo: i32,
bar: []const u8,
};
const string = try json.stringifyAlloc(
gpa.allocator(),
Foo{
.foo = 123,
.bar = "Hello, world!",
},
);
// {"foo":123,"bar":"Hello, world!"}
```
```md
Benchmark 1: zig-stdjson
Time (mean ± σ): 141.9 ms ± 1.1 ms [User: 140.4 ms, System: 1.0 ms]
Range (min … max): 140.1 ms … 144.1 ms 20 runs
Benchmark 2: zig-jaysan
Time (mean ± σ): 46.8 ms ± 1.3 ms [User: 46.2 ms, System: 0.4 ms]
Range (min … max): 43.1 ms … 49.2 ms 61 runs
Benchmark 3: rust-serde
Time (mean ± σ): 46.9 ms ± 0.9 ms [User: 45.8 ms, System: 0.9 ms]
Range (min … max): 45.9 ms … 50.9 ms 62 runs
Summary
zig-jaysan
1.00 ± 0.03 times faster than rust-serde
3.03 ± 0.09 times faster than zig-stdjson
```