forked from mitchellh/mapstructure
-
Notifications
You must be signed in to change notification settings - Fork 36
Closed
Description
I'm trying to convert a struct to a map, and can't figure out how to make it work.
Basically I have these structs:
type SQLStepResult struct {
Queries []QueryResult `mapstructure:"queries"`
}
type QueryResult struct {
Rows []map[string]any `mapstructure:"rows"`
}and I want to convert SQLStepResult to:
{
"queries": [
{
"rows": [
// ...
]
}
]
}But I always end up with Rows instead of rows.
I tried using the undocumented mapstructure.RecursiveStructToMapHookFunc but it doesn't appear to do anything
Is there a solution?
Go playground for reference: https://go.dev/play/p/ZlTOw1mqnH5
nakamarusun, andrzej-stencel, EronWright, mslynch and jphastings
Metadata
Metadata
Assignees
Labels
No labels