Live data from Hacker News

Show HN: Jason – A new JSON Library for Go

github.com

41–50 of 55 posts

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

#41

I 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

It's definitely safer, but it's a living hell having to define a class for each possible json structure in Java with gson.

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

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

How do you think this guy feels? http://en.wikipedia.org/wiki/Jake_Weary

Hint: Not the be confused with ...

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

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

Am I the only person who pronounces it as J-SON?

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

#45
post #40
post #32

Earlier quoted context omitted.

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

IMHO there is something rigid in Go,like C rigid.Sure,there is no manual memory management.But a modern language shouldnt need explicit pointers.

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

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

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.

I pronounce it Jay-Ess-Owe-Enn, for obvious reasons.

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

#47
post #45
post #40

Earlier quoted context omitted.

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.

IMHO there is something rigid in Go,like C rigid.Sure,there is no manual memory management.But a modern language shouldnt need explicit pointers.

> a modern language shouldnt need explicit pointers

I don't understand this. Can you clarify why you think this is a good idea?

My experience with languages that have implicit "references" (Python, Java, JavaScript) is that it's not clear when you're sharing and when you're copying data, leading to bugs and unnecessary allocations, respectively.

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

#48

I 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

It's definitely safer, but it's a living hell having to define a class for each possible json structure in Java with gson.

Not sure where Java came into the conversation but I found a service[1] which I find really helpful for generating Golang structs from JSON. There is also a CLI tool[2] that does the same.

[1]http://mholt.github.io/json-to-go/

[2]https://github.com/ChimeraCoder/gojson

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

#49
post #12

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…

(Another plug here) I did too! Except it runs in the browser: https://mholt.github.io/json-to-go And I agree with you about the complementary aspect. Sometimes you can't control the fact that your JSON will have a widely varying structure... but when you can, these generators are nice.

Great tool!

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

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

I would prefer something like Jason, even though it sounds like JSON, over something crazy like Unicorn Milk. I'm not saying you were suggesting something crazy, but just adding my two cents.

Come on, there's a huge middle ground between "Unicorn milk" and a name that isn't a homophone of the format it works with. Let alone the fact that I don't like my first name being used as the name of a library, I think it's a bad choice as when you're verbally discussing this library with another person you'd likely have to refer to it as "jason the library" or something similar to clarify it rather than just using a simple unambiguous name.
Post reply on HN