JSON: Difference between revisions

23 bytes added ,  12 years ago
→‎{{header|Go}}: library path update
(→‎{{header|TXR}}: Works with released functionality.)
(→‎{{header|Go}}: library path update)
Line 126:
=={{header|Go}}==
<lang go>package main
 
import "encoding/json"
import "fmt"
 
func main() {
var data map[string]interface{}
json.Unmarshal([]byte("`{ \"foo\": 1, \"bar\": [10, \"apples\"] }"`), &data)
fmt.Println(data)
 
sample := map[string]interface{}{ "blue": []interface{}{1,2}, "ocean": "water" }
"blue": []interface{}{1, 2},
"ocean": "water",
}
json_string, err := json.Marshal(sample)
if err == nil {
1,707

edits