jsonparser

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Getkey

func Getkey(o map[string]interface{}, keys ...string) (map[string]interface{}, error)

Getkey : get key from map string recursively

func Getkeystring

func Getkeystring(o map[string]interface{}, keys ...string) (string, error)

Getkeystring : get key from map string recursively

func JSONParser

func JSONParser(data []byte, keys ...string) (map[string]interface{}, error)

JSONParser : convert byte array of data and return path of keys value ex. how to use: data := []byte(`{"json": {"errors": [], "data": {"url": "www.example.com", "count": 0, "id": "123", "name": "foo"}}}`) obj, err := jsonparser.JSONParser(data, "json", "data")

if err != nil {
	panic(err)
}

fmt.Println(obj["name"])

func JSONParserstring added in v1.1.0

func JSONParserstring(data []byte, keys ...string) (string, error)

JSONParserstring : convert byte array of data and return path of keys value ex. how to use: data := []byte(`{"json": {"errors": [], "data": {"url": "www.example.com", "count": 0, "id": "123", "name": "foo"}}}`) name, err := jsonparser.JSONParser(data, "json", "data", "name")

if err != nil {
	panic(err)
}

fmt.Println(name)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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