Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arriqaaq/aefc61daddaa5a8509120e27d2a76880 to your computer and use it in GitHub Desktop.
Save arriqaaq/aefc61daddaa5a8509120e27d2a76880 to your computer and use it in GitHub Desktop.
Gjson Unmarshall
package main
import "github.com/tidwall/gjson"
const json = `{"name":{"first":"Janet","last":"Prichard"},"age":47}`
type User struct{
FirstName string `gjson:"name.first"`
LastName string `gjson:"name.last"`
Age string `gjson:"age"`
}
func main() {
res:=User{}
gjson.Unmarshall(json, &res)
println(res)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment