Using EasyJSON with Golang

1,171 views
Skip to first unread message

Debraj Manna

unread,
Nov 14, 2016, 6:41:50 AM11/14/16
to golang-nuts

Crossposting this from stackoverflow:-

Let's say I have a struct like below:-

//easyjson:json
type JSONData struct {
    Data []string
}

I want to un-marshal the below json to JSONData struct

{"Data" : ["One", "Two", "Three"]} 

Can someone let me know how can I use easyjson to un-marshal a json in Golang? I could not find any example in their README

Tyler Compton

unread,
Nov 14, 2016, 5:59:59 PM11/14/16
to golang-nuts
It looks like someone on Stack Overflow has answered your question[1].

You know your needs better than I do, but code generation seems like an unnecessarily complex way to unmarshal JSON code. I'd recommend taking a look at encoding/json[2] if you haven't already .
Reply all
Reply to author
Forward
0 new messages