• Stars
    star
    87
  • Rank 378,873 (Top 8 %)
  • Language
    Go
  • License
    BSD 3-Clause "New...
  • Created almost 3 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

High performance JSON iterator & validator for Go
GoDoc GoReportCard Coverage Status

jscan

jscan provides high-performance zero-allocation JSON iterator and validator for Go. This module doesn't provide Marshal/Unmarshal capabilities yet, instead it focuses on highly efficient iteration over JSON data with on-the-fly validation.

An experimental decoder with backward compatibility to encoding/json is WiP ๐Ÿงช and is expected to be introduced together with jscan v3.

jscan is tested against https://github.com/nst/JSONTestSuite, a comprehensive test suite for RFC 8259 compliant JSON parsers.

See jscan-benchmark for benchmark results ๐ŸŽ๏ธ ๐Ÿ.

Example

https://go.dev/play/p/moP3l9EkebF

package main

import (
	"fmt"

	"github.com/romshark/jscan/v2"
)

func main() {
	j := `{
		"s": "value",
		"t": true,
		"f": false,
		"0": null,
		"n": -9.123e3,
		"o0": {},
		"a0": [],
		"o": {
			"k": "\"v\"",
			"a": [
				true,
				null,
				"item",
				-67.02e9,
				["foo"]
			]
		},
		"a3": [
			0,
			{
				"a3.a3":8
			}
		]
	}`

	err := jscan.Scan(j, func(i *jscan.Iterator[string]) (err bool) {
		fmt.Printf("%q:\n", i.Pointer())
		fmt.Printf("โ”œโ”€ valueType:  %s\n", i.ValueType().String())
		if k := i.Key(); k != "" {
			fmt.Printf("โ”œโ”€ key:        %q\n", k[1:len(k)-1])
		}
		if ai := i.ArrayIndex(); ai != -1 {
			fmt.Printf("โ”œโ”€ arrayIndex: %d\n", ai)
		}
		if v := i.Value(); v != "" {
			fmt.Printf("โ”œโ”€ value:      %q\n", v)
		}
		fmt.Printf("โ””โ”€ level:      %d\n", i.Level())
		return false // Resume scanning
	})

	if err.IsErr() {
		fmt.Printf("ERR: %s\n", err)
		return
	}
}

More Repositories

1

webwire-go

A transport independent asynchronous duplex messaging library for Go
Go
216
star
2

Go-1-2-Proposal---Immutability

A a Go 1/2 language feature proposal to immutability
171
star
3

dgraph_graphql_go

A GraphQL + Dgraph + Go + HTTP based backend service demo.
Go
50
star
4

QuickStreams

An asynchronous programming library for the QML programming language (Proof of Concept)
C++
46
star
5

llparser

A universal LL top-down parser written in Go
Go
45
star
6

sched

A job scheduler for Go with the ability to fast-forward time.
Go
28
star
7

templier

A Go Templ web frontend development environment that automatically rebuilds the server and reloads the tab.
Go
21
star
8

yamagiconf

The magic YAML configuration framework for Go
Go
15
star
9

goesgen

Go code generator for event-sourced systems
Go
12
star
10

webwire-js

A client implementation for the webwire-go asynchronous messaging library.
JavaScript
12
star
11

watchserve

An HTTP file server that's watching the served file for updates and automatically reloads the page
Go
9
star
12

taskhub

A GraphQL demo of a JIRA-like task tracking system demonstrating the use of persisted queries.
Go
7
star
13

eventlog

A persistent append-only event database
Go
7
star
14

go-battle-simulator

A concurrent battle simulator written in Go (#codingforfun)
Go
6
star
15

tmdwg-go

A timed analogue of sync.WaitGroup for Golang
Go
5
star
16

qbeon.com

The website that is hosted on qbeon.com serving as an introduction of Qbeon and the Qube network attache storage device with the intention to attract investment.
HTML
5
star
17

utf8

A fork of the encoding/utf8 Go standard library package with experimental performance optimizations.
Go
4
star
18

gapi

Graph API
Go
3
star
19

valfile

A CLI tool to statically check env vars, YAML, TOML, JSON, HCL, Jsonnet and .env files against a Go type.
Go
3
star
20

jscan-experimental-decoder

This is an experimental JSON decoder for Go based on jscan
Go
3
star
21

eventlog-example

This example showcases an event-sourced CQRS system based on github.com/romshark/eventlog
Go
3
star
22

demo-islands

An HTMX, Go, Templ, Templier, Svelte & WebComponents demo demonstrating the islands architecture.
CSS
2
star
23

rebuzzer

Rebuzzer is a fullscreen button in the browser which executes a command on the server by clicking on it
JavaScript
2
star
24

pres-jscan

Presentation of jscan at Go meetup in Zurich (October 3th 2023)
Go
2
star
25

jsonvalidate-go

High-performance JSON validation in Go
Go
1
star
26

htmx-demo-todoapp

An attempt at structuring an HTMX-driven Hypermedia application.
Go
1
star
27

shallyapassbot

Telegram anti-spam bot
Go
1
star
28

messenger-sim

A simulation of an event-sourced messenger system in Go
Go
1
star
29

contacts.qbeon.com

VCards for public appearance
HTML
1
star
30

jscan-benchmark

Benchmarks comparing github.com/romshark/jscan to other modules
Go
1
star
31

webwire-example-postboard

An advanced full-featured example of a webwire-go powered real-time application
Go
1
star
32

service-modelling-language

An experimental specification of an abstract service modelling language similar to GraphQL
Standard ML
1
star
33

strings

An attempt at improving the performance of Go standard library functions
Go
1
star