Skip to content

Instantly share code, notes, and snippets.

Created Mar 24, 2012
What would you like to do?
match Go type to json
#!/usr/bin/env gorun
package main
import (
type MyJSONType struct {
A int
B string
func main() {
s := "{\"A\":123,\"B\":\"hello\"}"
var mjt MyJSONType
um_err := json.Unmarshal([]byte(s),&mjt)
if um_err == nil {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment