[30] Results

Golang : How to convert JSON string to map and slice

golang json-to-map json-to-slice array

Couple of simple examples on how to convert JSON string to map and slice(array).

Simple and straightforward way of converting….... read more

Golang : Count JSON objects and convert to slice/array

golang json count-json-objects pagination elastic-search

Problem :

You have an array of JSON objects and you want to count the number of JSON objects. You….... read more

Golang : Unmarshal JSON from http response

golang http get json unmarshal

For this tutorial, we will learn how to unmarshal JSON data retrieved from http.Get() function. Using the HTTP….... read more

Golang : fmt.Println prints out empty data from struct

golang fmt-println struct json

Problem :

Your code compiled successfully and there is no error indicator whatsoever. However, during runtime, the fmt.Println function prints….... read more

Golang : Clean formatting/indenting or pretty print JSON result

golang json indent clean-format


Your Golang program is producing JSON result in a single line that looks like this :

.... read more

Golang : How to unmarshal JSON inner/nested value and assign to specific struct?

golang inner-JSON unmarshal struct

Another tutorial to be recorded here after helping a newbie to Golang. His problem was how to deal with JSON….... read more

Golang : How to convert strange string to JSON with json.MarshalIndent

golang curly-braces json-marshallindent strings-replace


Your database is spewing out a funny looking string that looks like this {"width";800;"height";450} and you want to map….... read more

Golang : Decode/unmarshal unknown JSON data type with map[string]interface

golang json map interface unmarshal decode

This tutorial is courtesy of Rohan Allison on how to decode or unmarshal JSON into map[string]interface. There are….... read more