Skip to content

How To Get Mapping Table With JSON Field Names as Map Fields Instead? #5679

Answered by jinzhu
KiddoV asked this question in Q&A
Discussion options

You must be logged in to vote

GORM don't support to use the json tag for the key, and I think it doesn't make much sense.

For your question, maybe you can use

db.Select("user_id as userId, last_name as lastName...").Model(&User{}).Find(&data)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by KiddoV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants