body-parser – extended option (qs vs querystring)

The reason for this message is that body-parser is about to change default value for extended from true to false.

Extended protocol uses qs library to parse x-www-form-urlencoded data. The main advantage of qs is that it uses very powerful serialization/deserialization algorithm, capable of serializing any json-like data structure.

But web-browsers don’t normally use this protocol, because x-www-form-urlencoded was designed to serialize flat html forms. Though, it may come in handy if you’re going to send rich data structures using ajax.

querystring library` provides basic serialization/deserialization algorithm, the one used by all web-browsers to serialize form data. This basic algorithm is significantly simpler than extended one, but limited to flat data structures.

Both algorithms work exactly the same with flat data.

Now, when you know pros and cons of both algorithms, it’s up to you to decide which one suits your application better.

Leave a Comment