Overview
Assume we have below query param string
a=b&x=y
We want the output as a map as below
map[a:b x:y]
Program
Below is the program for the same
package main
import (
"fmt"
"strings"
)
func main() {
query_param_map := make(map[string]string)
input := "a=b&x=y"
input_split := strings.Split(input, "&")
for _, v := range input_split {
v_split := strings.Split(v, "=")
query_param_map[v_split[0]] = v_split[1]
}
fmt.Println(query_param_map)
}
Output
map[a:b x:y]