Is there a way to marshal and unmarshal json with different tag other than ‘json’?

Written by
Link to Post

https://www.reddit.com/r/golang/comments/add2q9/is_there_a_way_to_marshal_and_unmarshal_json_with/

So for example I have a struct

type User struct { FirstName string `json:"first_name" json2:"f_name" LastName string `json:"last_name" json2:"l_name" } 

Is there a way to create a function called MarshalWithJSON2Tag()?

submitted by /u/thereisnosuch
[link] [comments]

Article Tags:
· ·
Article Categories:
reddit

Leave a Reply