ljharb / qs

A querystring parser with nesting support
BSD 3-Clause "New" or "Revised" License
8.47k stars 731 forks source link

feature request : add exclude specific keys to options array #499

Closed mojtabamaslahatbin closed 1 month ago

mojtabamaslahatbin commented 4 months ago

in this function stringify(object, [options]);

when we have a key in object that we don't want to serialize it , we need to exclude it in options . for example: i need this :

  &orderBy= {"property":"Amount","direction":"desc"}

but after serializing params object , result is like this :

&orderBy[property]=Amount&orderBy[direction]=asc
ljharb commented 4 months ago

I’m not sure what you mean. You have an API that accepts JSON a in a query string? That seems bizarre to me.

mojtabamaslahatbin commented 4 months ago

yes unfortunately in this wiered case it accepts JSON a in a query string😄. but In general, the possibility of excluding a part of the data can be used for different use cases.

ljharb commented 4 months ago

Seems like you should already be able to do this with a custom encoder.