Created
March 26, 2018 14:02
-
-
Save douglarek/3073a8a6b86ef51e9e1b712e3cb3d71b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 "encoding/json" | |
// jsonText comes from http://json.org/example.html | |
var jsonText = []byte(` | |
{ | |
... // 此处省略, 同上 | |
}`) | |
type glossarySectional struct { | |
Glossary struct { | |
Title string `json:"title"` | |
GlossDiv struct { | |
Title string `json:"title"` | |
GlossList json.RawMessage `json:"GlossList"` // diff: delay JSON decoding | |
} `json:"GlossDiv"` | |
} `json:"glossary"` | |
} | |
func main() { | |
var g glossarySectional | |
json.Unmarshal(jsonText, &g) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment