- From: Alexander Vorobyev <notifications@github.com>
- Date: Wed, 29 Oct 2025 13:44:40 -0700
- To: whatwg/url <url@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/url/issues/889/3463916578@github.com>
Voral left a comment (whatwg/url#889)
I apologize, I was wrong to mention Axios as a ready-made solution - it itself requires additional tools to work with PHP.
**Example with Axios + qs:**
```js
import qs from 'qs';
const api = axios.create({
paramsSerializer: params => qs.stringify(params, {arrayFormat: 'brackets'})
});
// Request with array and object
api.get('/api', {
params: {
categories: ['books', 'movies'], // array
filters: { // object
price: {min: 100, max: 500},
inStock: true
}
}
});
// Result: categories[]=books&categories[]=movies&filters[price][min]=100&filters[price][max]=500&filters[inStock]=true
```
**The same example in jQuery:**
```js
$.get('/api', {
categories: ['books', 'movies'], // array
filters: { // object
price: {min: 100, max: 500},
inStock: true
}
});
// Result: categories[]=books&categories[]=movies&filters[price][min]=100&filters[price][max]=500&filters[inStock]=true
```
jQuery really does handle this task excellently "out of the box," which is not surprising - it's one of the most popular libraries, created during the heyday of PHP. However, in new projects, jQuery is often considered an outdated solution.
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/889#issuecomment-3463916578
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/url/issues/889/3463916578@github.com>
Received on Wednesday, 29 October 2025 20:44:44 UTC