easyjson

package module
v0.0.0-...-190b0f3 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2015 License: MIT Imports: 3 Imported by: 0

README

easyjson

Quickly consume JSON in Go.

Build Status

While defining structs is a great means to generate a JSON API, it's a bit annoying when you want to consume some arbitrary JSON from another server.

This makes that easier.

someJson := `
{
	"some": {
		"nested": {
			"path": "a string!"
		}
	}
}`

data, err := easyjson.DecodeJson([]byte(someJson))

if err != nil {
	log.Fatal(err)
}

someString, err := easyjson.GetString(data, "some, "nested", "path")

// Prints "a string!"
fmt.Printf("%s", someString)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBool

func GetBool(j JSData, keys ...interface{}) (bool, error)

func GetFloat

func GetFloat(j JSData, keys ...interface{}) (float64, error)

func GetMap

func GetMap(j JSData, keys ...interface{}) (map[string]interface{}, error)

func GetSlice

func GetSlice(j JSData, keys ...interface{}) ([]interface{}, error)

func GetString

func GetString(j JSData, keys ...interface{}) (string, error)

Types

type JSData

type JSData interface{}

func DecodeJson

func DecodeJson(str []byte) (JSData, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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