Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hey Google, you know what this isn't? Valid JSON.

A Thankyou To Google

Dear Google,

I'd just like to thank you for disabusing me of the idea that JSON is under some requirement of well-formedness. I'd been labouring under the tyrannical misapprehension that some standards body had written down how JSON was supposed to work and that if I wanted to claim I was using JSON I would have to comply with that specification.

However, I today received a bug report indicating that a project to which I contribute was unable to make HTTP requests your Google Flights website could understand. I found this perplexing, but my eyes were opened when I saw your HTTP request. In particular, I enjoyed your freeform and inclusive definition of JSON. Allow me to show you what you've called JSON by showing you my SPDY request:

:host:www.google.fr
:method:POST
:path:/flights/rpc
:scheme:https
:version:HTTP/1.1
content-length:219
content-type:application/json; charset=UTF-8
origin:https://www.google.fr
referer:https://www.google.fr/flights/

[,[[,"tb","[,[,[[,[\"CFE\"],[\"ORY\",\"CDG\"],\"2014-04-10\"],[,[\"ORY\",\"CDG\"],[\"CFE\"],\"2014-04-14\"]]]]","1842631716884948",3]],[,[[,"b_al","ld:67"],[,"b_ahr","ld:s"],[,"b_am","tb"],[,"b_qu","0"],[,"b_qc","4"]]]]

Let's take another look at that Content-Type header:

content-type:application/json; charset=UTF-8

And now the body:

[,[[,"tb","[,[,[[,[\"CFE\"],[\"ORY\",\"CDG\"],\"2014-04-10\"],[,[\"ORY\",\"CDG\"],[\"CFE\"],\"2014-04-14\"]]]]","1842631716884948",3]],[,[[,"b_al","ld:67"],[,"b_ahr","ld:s"],[,"b_am","tb"],[,"b_qu","0"],[,"b_qc","4"]]]]

Wait, what?

Thanks for opening my eyes, Google!

Signed,

A Newly Liberated Software Engineer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.