Show HN: Jason – A new JSON Library for Go
21–30 of 55 posts
Re: Show HN: Jason – A new JSON Library for Go
#22I would stray away from making the library name too similar in phonetic sound to the data it's meant to process. There was already enough confusion in an office I worked at with a non-developer whose name was "Jason"
I pronounce JSON as "jay-sawn" to avoid the confusion with the name. I've heard "jiss-on" and various other mutations used as well.
Re: Show HN: Jason – A new JSON Library for Go
#23For anyone wondering why this is necessary, as some others in this thread have mentioned, the standard go way to deserialize json is to pass a pointer to a struct, and the system will "fill" it with the json. There is no easy way to sort of "parse" json piece by piece, which is what this library provides
> There is no easy way to sort of "parse" json piece by piece You mean like this? http://play.golang.org/p/mMh7HGuTbe
Re: Show HN: Jason – A new JSON Library for Go
#24if anyone is interested i did some slight modifications to the project above which are keep in my personal fork: https://github.com/W4RH4WK/simplejson
Re: Show HN: Jason – A new JSON Library for Go
#25For anyone wondering why this is necessary, as some others in this thread have mentioned, the standard go way to deserialize json is to pass a pointer to a struct, and the system will "fill" it with the json. There is no easy way to sort of "parse" json piece by piece, which is what this library provides
Passing a pointer to a struct is just one way to use the standard Go package. You can also pass a pointer to an interface{}, []interface{} or map[string]interface{} depending on how much of the structure you know. You can also use these types in struct fields.
Re: Show HN: Jason – A new JSON Library for Go
#26[deleted]
Here this nice person created something for themselves and decided to share it with others and this is your reaction. There are a number of ways to express the question "What are the advantages of using this tool over the stdlib?" without coming across as needlessly confrontational. It's unfortunate that so many of these "Show HN" threads turn into this.
But ok, I will delete the post anyway.
Re: Show HN: Jason – A new JSON Library for Go
#27I would say the most idiomatic way is having defined structs and using encoding/json. Even when you don't know the json schema in advance you can still parse it into an interface{}. Here's an example: http://play.golang.org/p/jrqBcPuQei
Re: Show HN: Jason – A new JSON Library for Go
#28Earlier quoted context omitted.
> There is no easy way to sort of "parse" json piece by piece You mean like this? http://play.golang.org/p/mMh7HGuTbe
You're still parsing the entire JSON document at once. I believe what OP meant was getting a nested property without all the overhead of writing structs or parsing the entire JSON object into an interface{}, []string, map or whatever else is appropriate.
Re: Show HN: Jason – A new JSON Library for Go
#29Re: Show HN: Jason – A new JSON Library for Go
#30I would say the most idiomatic way is having defined structs and using encoding/json. Even when you don't know the json schema in advance you can still parse it into an interface{}. Here's an example: http://play.golang.org/p/jrqBcPuQei
You can parse JSON into an interface, but you end up doing tiresome casts if you structure is just somewhat nested.