We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
I trying to convert my filter object
{ "type": 1, "from": "2019-11-04", "until": "2019-11-13", "status": "blocked" }
To this format:
?filter[type]=1&filter[from]=2019-11-04&filter[until]=2019-11-13&filter[status]=blocked
Is there a way to achieve this?
Thanks!
The text was updated successfully, but these errors were encountered:
@sebsobseb you could do
const params = { "filter[type]": 1, "filter[from]": "2019-11-04", "filter[until]": "2019-11-13", "filter[status]": "blocked" } qs.stringify(params);
Sorry, something went wrong.
@lucasassisrosa your solution works, thanks. With help of Lodash i ended up with this solution:
return qr.stringify(_.chain(filterObject) // Remove null values .omitBy(_.isNull) // Wrap filter keys with 'filter[]' .mapKeys((filterValue, filterKey) => { return `filter[${filterKey}]`; }) .value() );
No branches or pull requests
Hi,
I trying to convert my filter object
To this format:
?filter[type]=1&filter[from]=2019-11-04&filter[until]=2019-11-13&filter[status]=blocked
Is there a way to achieve this?
Thanks!
The text was updated successfully, but these errors were encountered: