You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why do we unmarshal the json as a string?
This seems a bit odd to me. Wouldn't something likeinterface{} be better?
Describe the solution you'd like
Replace the json string with interface{} or map[string]interface{}. This makes the extraction of elements easier, and its more efficient. This makes the following possible:
var result map[string]interface{}
json.Unmarshal([]byte(empJson), &result)
stuff := result["stuff"].(map[string]interface{})
foo := stuff["foo"]
The text was updated successfully, but these errors were encountered:
@patrickpichler gave an awesome feedback here:
Describe the solution you'd like
Replace the json string with
interface{}
ormap[string]interface{}
. This makes the extraction of elements easier, and its more efficient. This makes the following possible:The text was updated successfully, but these errors were encountered: