Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

jackfan.us.kg/mattn/go-jsonpointer

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jackfan.us.kg/mattn/go-jsonpointer

Go Modules
Version
v0.0.1
Version published
Created
Source

go-jsonpointer

Build Status Codecov GoDoc Go Report Card

Go implementation of JSON Pointer (RFC6901)

Usage

jsonpointer.Get(obj, pointer)

json := `
{
	"foo": [1,true,2]
}
`
var obj interface{}
json.Unmarshal([]byte(json), &obj)
jsonpointer.Get(obj, "/foo/1") // Should be true

jsonpointer.Set(obj, pointer, newvalue)

json := `
{
	"foo": [1,true,2]
}
`
var obj interface{}
json.Unmarshal([]byte(json), &obj)
jsonpointer.Set(obj, "/foo/1", false)
// obj should be {"foo":[1,false,2]}

jsonpointer.Remove(obj, pointer)

json := `
{
	"foo": [1,true,2]
}
`
var obj interface{}
json.Unmarshal([]byte(json), &obj)
jsonpointer.Remove(obj, "/foo/1")
// obj should be {"foo":[1,2]}

Installation

$ go get github.com/mattn/go-jsonpointer

License

MIT

Author

Yasuhiro Matsumoto (a.k.a mattn)

FAQs

Package last updated on 28 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts