[deleted]
Re:Show HN: Jason – A new JSON Library for Go
by collinvandyck76 on Tuesday December 02, 2014 @12:15PM
(#8688229)
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.
Re:Show HN: Jason – A new JSON Library for Go
by throwaway90446 on Tuesday December 02, 2014 @01:02PM
(#8688616)
I was genuinely curious, hence my question. I did not realize HN had the requirement that all posts be run through some sort of psychic expectation filter that magically tells me the exact mental state of other people and how the post will "come across" to them.
But ok, I will delete the post anyway.
Re:Show HN: Jason – A new JSON Library for Go
by antonholmquist on Tuesday December 02, 2014 @11:37AM
(#8687941)
Thanks for your feedback. I created the library simply because it just fits my use cases better. I have used encoding/json quite a lot, and for instance, I think golang's strict types makes it inconvenient to dig through arbitrary maps in a quick way.
That's what the Get-method in Jason is trying to solve. Similar to how bitly/go-simplejson does it, but with some fine tuning.
Re:Show HN: Jason – A new JSON Library for Go
by ryanlschneider on Tuesday December 02, 2014 @12:19PM
(#8688267)
Speaking of the .Get method, wouldn't returning an error alongside the value instead of just the default object be more idiomatic?
Re:Show HN: Jason – A new JSON Library for Go
by courtf on Tuesday December 02, 2014 @02:37PM
(#8689306)
I think it would be nice to return a bool, rather than an error. It really is just a binary condition and this pattern fits nicely with accessing values in maps. That said, I haven't really found a need for a .Get method in my own code, and will probably just stick with encoding/json for the time being.
Re:Show HN: Jason – A new JSON Library for Go
by libria on Tuesday December 02, 2014 @12:29PM
(#8688352)
It looks like .Get uses the null pattern (ie, returns a Jason struct with data = `nil` if nothing is found). Your way is more idiomatic, but it looks like his point with this library is to access the data conveniently in exchange for type-safety. `exists()` can verify something was found if needed.
Re:Show HN: Jason – A new JSON Library for Go
by bluehazed on Tuesday December 02, 2014 @11:28AM
(#8687889)
Looks like it reduces initial cost of creating structures, etc for JSON data received and makes accessing the data easier.
The author does seem to say the library is more focused on reading the data rather than writing it.
Whether or not this is a benefit or not is up to you and your use case I guess.