Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index.golang.org: index.golang.org/index does not return valid JSON #32369

Closed
smswz opened this issue May 31, 2019 · 4 comments
Closed

index.golang.org: index.golang.org/index does not return valid JSON #32369

smswz opened this issue May 31, 2019 · 4 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.

Comments

@smswz
Copy link

smswz commented May 31, 2019

Doing a GET on index.golang.org/index returns something similar to

{"Path":"golang.org/x/text","Version":"v0.3.0","Timestamp":"2019-04-10T12:08:52.997264-07:00"}
{"Path":"golang.org/x/crypto","Version":"v0.0.0-20190404164418-38d8ce5564a5","Timestamp":"2019-04-10T13:30:02.04035-07:00"}
{"Path":"github.com/FiloSottile/mkcert","Version":"v1.3.0","Timestamp":"2019-04-10T13:30:31.325463-07:00"}

and the headers say that you are returning application/json. However, this looks to be JSON lines and not valid JSON. Is returning non-standard JSON the correct approach? I understand the merits of JSONL/NDJSON, but without any indication that it is in this format, it is pretty confusing.

@heschi heschi added the NeedsFix The path to resolution is known, but the work has not been done. label May 31, 2019
@heschi
Copy link
Contributor

heschi commented May 31, 2019

Seems that application/x-ndjson is the thing for this. TIL.

@smswz
Copy link
Author

smswz commented May 31, 2019

I looked into it. Unfortunately, the only two I've seen are the aforementioned application/x-ndjson and application/jsonl and they are both non-standard.

@katiehockman
Copy link
Contributor

katiehockman commented Jun 4, 2019

We want to stick with the current output of newline separated json, since it is a valid way of streaming json. But since there isn't a content type that matches this output, we'll just go with text/plain for now.
I tried out application/x-ndjson, but as you said, it's non-standard, and had some negative effects when viewing in the browser.

@smswz
Copy link
Author

smswz commented Jun 5, 2019

Okay, thanks!

@golang golang locked and limited conversation to collaborators Jul 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants