unjson

package module
v0.0.0-...-22a53c6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2019 License: MIT Imports: 6 Imported by: 1

README

unjson

Get JSON values just like in node, without structs, just path with dot notation + brackets

Uses GJson internally. Wraps a very limited subset of it to support bracket indexing.

example

data := unjson.LoadFile("lighthouse.json")
v := unjson.Get(data, "audits.screenshot-thumbnails.details.items[3].timing")

benchmarks

Benchmark_LargeFile_unjson-12    	    1236	    818774 ns/op	    4224 B/op	      58 allocs/op
Benchmark_LargeFile_GJson-12     	    1377	    814089 ns/op	    4224 B/op	      58 allocs/op
Benchmark_SmallFile_unjson-12    	  537495	      2141 ns/op	      40 B/op	       3 allocs/op
Benchmark_SmallFile_GJson-12     	  600687	      2054 ns/op	      40 B/op	       3 allocs/op

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(data string, path string) interface{}

Get returns object found in path

func LoadFile

func LoadFile(filename string) string

LoadFile reads file from disk

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL