advantage application/x-www-form-urlencoded over application/json

Viewed 1159

Looking at Facebook, Google, Twitter's POST requests. They all use application/x-www-form-urlencoded as content-type to send their request. (Ex: when you like a status on Facebook).

Why don't they use application/json?

On production, I've noticed 2 disadvantages with application/x-www-form-urlencoded.

1) If I send a=false&b=0&c=null. The server doesn't know the original type of the value, whether false, 0, null are strings or boolean, int, null.

2) If sending a nested JSON. Usually the server module that does the parsing has to explicitly know which field is the stringified json, and parse it.

The above 2 issues doesn't exist for application/json, because you just cleanly stringify and parse the data around.

So overall, what are really the advantage of application/x-www-form-urlencoded, and why the big companies decided to not use application/json? Thanks!

0 Answers
Related