Live data from Hacker News

Show HN: Jason – A new JSON Library for Go

github.com

1–10 of 55 posts

Re: Show HN: Jason – A new JSON Library for Go

#3
post #2

[deleted]

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.

Re: Show HN: Jason – A new JSON Library for Go

#4
post #2

[deleted]

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

#6
post #5

I 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"

Haha, okay. Yes, I just really like the name since it originates from an email sent from one of the project managers at our office: "Don't worry. We can handle both XML and Jason".

Re: Show HN: Jason – A new JSON Library for Go

#7
This looks like a good approach to dealing with heterogeneous JSON! (ie, JSON that has an unknown and/or variable structure.) I've always found encoding/json a little clunky for this.

Shameless but relevant plug - if you do know the structure of your JSON in advance, I wrote a tool for automatically generating the appropriate struct definition for it: https://github.com/ChimeraCoder/gojson

(I see these as complimentary tools, rather than conflicting or competing, since they would have two different use cases).

Re: Show HN: Jason – A new JSON Library for Go

#8
post #2

[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.

Re: Show HN: Jason – A new JSON Library for Go

#9
For 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

Re: Show HN: Jason – A new JSON Library for Go

#10

This looks like a good approach to dealing with heterogeneous JSON! (ie, JSON that has an unknown and/or variable structure.) I've always found encoding/json a little clunky for this. Shameless but relevant plug - if you do know the structure of your JSON in advance, I wrote a tool for automatically generating the appropriate struct definition for it: https://github.com/ChimeraCoder/gojson (I see these as complimenta…

This.

If your main use case is JSON as a serialized representation of the ever same object (plus or minus a few optional fields), encoding/json is by far the fastest and most typesafe way to go.

(edit: Protip - for the really really fastest way to demarshal JSON, look here https://github.com/pquerna/ffjson for some reflection-free extra speed after your code has settled down)

But if your objects can be heterogenous for whatever reasons (think third-party systems, different languages, legacy stacks...) or you're dealing with different kinds of objects landing on the same controller, jason is the perfect complimentary device to deal with more dynamic structures. I've long sought for something like this, thanks to the OP!

Post reply on HN