[88] 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 : Convert string slice to struct and access with reflect example

golang reflect slice-to-struct

Writing this down here for my own future references. Basically, what this code does is to convert a given string….... read more

Golang : Save map/struct to JSON or XML file

golang XML json save-to-file

Previous tutorial on converting map/slice/array to JSON or XML format is for output to web via net/http package.….... read more

Golang : Output or print out JSON stream/encoded data

golang json-stream write-to-responsewriter content-type

Problem :

You need to produce JSON stream or JSON encoded data to web browser or client. How to do….... read more

Golang : Get all countries phone codes

golang json-unmarshal-to-map countries-phone-codes iso

Continue from previous tutorial where we learn how to get all the currencies names, but this time it….... read more

Golang : Display list of countries and ISO codes

golang json-unmarshal-to-map countries-name iso

The code example below will download the JSON formatted data from http://country.io/names.json and unmarshal the data to display a list….... read more

Golang : Word limiter example

golang slice-to-string word-limiter count-words


You want to limit a string to X number of words. How to do that?


Break the string….... read more

Golang : Get all countries currencies code in JSON format

golang json-unmarshal-to-map currencies-name iso

For this tutorial, we will learn how to get all the currencies names from http://country.io/currency.json and un-marshall them into a….... read more