Guest User

Untitled

a guest
Nov 25th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. "encoding/json"
  6. )
  7.  
  8. func main() {
  9. strJson := `{"key1": "value1", "key2": {"key2.1": "value2.1"}}`
  10.  
  11. var jsonified map[string]interface{}
  12.  
  13. json.Unmarshal([]byte(strJson), &jsonified)
  14. fmt.Println("%v", jsonified) // "map[key2:map[key2.1:value2.1] key1:value1]"
  15.  
  16. fmt.Println("%v", jsonified["key2"].(map[string]interface{})["key2.1"]) // "value2.1"
  17. }
Add Comment
Please, Sign In to add comment