Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "encoding/json"
- import "fmt"
- import "os"
- type Response1 struct {
- Device string
- Type string
- Data map[string]interface{}
- }
- func main() {
- str := `{"Device": "host", "Type": "request", "Data": {"total": 120, "payment": 200, "order_sub": [{"seq": 1, "name": "Capuchino"}]}}`
- response := Response1{}
- json.Unmarshal([]byte(str), &response)
- fmt.Println(response.Data)
- enc := json.NewEncoder(os.Stdout)
- enc.Encode(response.Data)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement