Created
May 2, 2018 07:32
-
-
Save arriqaaq/aefc61daddaa5a8509120e27d2a76880 to your computer and use it in GitHub Desktop.
Gjson Unmarshall
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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