Categorygithub.com/gobs/jsonpath
modulepackage
1.0.0
Repository: https://github.com/gobs/jsonpath.git
Documentation: pkg.go.dev

# README

jsonpath

Minimalistic implementation of jsonpath, based on http://goessner.net/articles/JsonPath/.

But a better grammar definition is here.

Documentation

https://godoc.org/github.com/gobs/jsonpath

Usage

Install:

go get github.com/gobs/jsonpath

And use it as a library:

package main

import "github.com/gobs/jsonpath"
import "fmt"

func main() {
    jsonpathexpr := "$.items[3].stuff"

    p := jsonpath.NewProcessor()
    if !p.Parse(jsonpathexpr) {
        return
    }

    // loaded from JSON
    input := map[string]interface{}{
        "name": "joe",
        "items": []interface{}{
            "zero",
            "one",
            "two",
            map[string]interface{}{
                "stuff": "three",
            },
        },
    }

    ret := p.Process(input, jsonpath.Default)
    fmt.Println(ret)
}

Or install the command:

go get github.com/gobs/jsonpath/cmd/jsonpath

And run it:

jsonpath "$.items[3].stuff" input.json

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# Functions

NewProcessor creates a new grammar Processor.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
not a valid identifiers.
No description provided by the author

# Structs

Node defines a processing node.
Processor defines the JsonPath grammar processor.

# Type aliases

Operation is a method that perform an operation (conditional or not).
No description provided by the author