Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. package main
  2.  
  3. import "encoding/json"
  4. import "fmt"
  5. import "os"
  6.  
  7. type Response1 struct {
  8. Device string
  9. Type string
  10. Data map[string]interface{}
  11. }
  12.  
  13. func main() {
  14. str := `{"Device": "host", "Type": "request", "Data": {"total": 120, "payment": 200, "order_sub": [{"seq": 1, "name": "Capuchino"}]}}`
  15. response := Response1{}
  16. json.Unmarshal([]byte(str), &response)
  17. fmt.Println(response.Data)
  18.  
  19. enc := json.NewEncoder(os.Stdout)
  20. enc.Encode(response.Data)
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement