Skip to content

echo-health/jsonstream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON Stream

Streaming parser for JSON with some simple path matching based on JSON path.

Simple example:

package main

import (
	"strings"

	"github.com/echo-health/jsonstream"
	"github.com/sanity-io/litter"
)

func main() {
	p := jsonstream.New(strings.NewReader(`
        {
            "a": {
                "b": [
                    {"c": 1},
                    {"c": 2},
                    {"c": 3}
                ]
            }
        }
    `))

	// visits every element in "a.b"
	p.On("$.a.b[*]", func(key string, value struct{ C int }) error {
		litter.Dump(value)
		return nil
	})

	err := p.Decode()
	if err != nil {
		panic(err)
	}
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published