The below is my sample code in Go. I want to parse the value of B and check value of key 'status'
package main
import (
"encoding/json"
"fmt"
)
type ValidateUser struct {
UserName, status, sessionID, timestamp string
}
func main() {
// This JSON contains an int array.
B := "{\"UserName\": \"Moulali\",\"status\": \"valid_user\"}"
fmt.Println("outside if")
fmt.Println("ValueOfB = %v", B)
bytes := []byte(B)
var validateUser ValidateUser
json.Unmarshal(bytes, &validateUser)
if validateUser.status == "valid_user" {
fmt.Printf("Valid User")
}
}