Live data from Hacker News

Show HN: Jason – A new JSON Library for Go

github.com

31–40 of 55 posts

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

#31

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

Or to do a streaming parse with json.Decoder.

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

#32

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

>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

I sometimes have trouble understanding Go. It kind of seems to retain a lot of the bad parts of C in terms of developer-friendliness, while still being relatively slower than C and garbage-collected.

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

#34
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"

We had a developer named Jason, fortunately he mainly did XML.

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

#35
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"

We had a developer named Jason, fortunately he mainly did XML.

> fortunately he mainly did XML

Out of context, you sound insane.

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

#36

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

I've made something very similar for a current project and haven't gotten around to extracting it as a separate pkg yet, but it is much more loose on the coercion, e.g. when calling String() on an int(5) you will get back "5", etc.

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

#37

Earlier quoted context omitted.

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.

Speaking of the .Get method, wouldn't returning an error alongside the value instead of just the default object be more idiomatic?

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

#38
post #32

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

>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 I sometimes have trouble understanding Go. It kind of seems to retain a lot of the bad parts of C in terms of developer-friendliness, while still being relatively slower than C and garbage-collected.

[deleted]

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

#39
post #22

Earlier quoted context omitted.

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.

American? The North American accent pronounces "Python" similarly, as "py-THAWN" instead of "PIE-thn".

I usually pronounce it that way as well, I'm American, and it does rhyme with Python that way for me.

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

#40
post #32

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

>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 I sometimes have trouble understanding Go. It kind of seems to retain a lot of the bad parts of C in terms of developer-friendliness, while still being relatively slower than C and garbage-collected.

What are you having trouble with in this instance? Pointers and structs? Both are very simple, well understood concepts. Their implementation in Go is also more syntactically clear than in C.
Post reply on HN