Skip to content

lyf-coder/entity

Repository files navigation

entity

Go json access like viper

Actions GoDoc Go Report Card

Install

go get github.com/lyf-coder/entity

Usage

import (
    "github.com/lyf-coder/entity"
)
// json string
jsonStr := `{"IP": "127.0.0.1", "admin": {"name":"jack"}}`

// json string to []byte
b := []byte(jsonStr)

// new entity
entity := entity.NewByJSON(b)

// Usage
entity.GetString("IP")  // "127.0.0.1"
entity.GetString("admin:name")  // "jack"