0

I'm making a get request similar to this:

axios.get('https://example.org/getJobs', { params: { salaries, ... } }); // ... represents more params

where salaries is an array of arrays, or ranges, that I use to filter the jobs returned. I can access it fine on req.query.salaries, but it arrives on the server in the following format:

[ '["0","20000"]', '["20000","30000"]', '["30000","40000"]' ]

I'm just wondering what the best way to parse this is?

*Edit: Just to be clear, the array is originally sent in this format: [['0', '20000'], ['20000', '30000'], ['30000', '40000']]

salaries logged just before calling axios.get():

(5) [Array(2), Array(2), Array(2), Array(2), Array(2)]
0: (2) ['0', '20000']
1: (2) ['20000', '30000']
2: (2) ['30000', '40000']
3: (2) ['40000', '50000']
4: (2) ['50000', '60000']
length: 5
[[Prototype]]: Array(0)
NickW
  • 1,207
  • 1
  • 12
  • 52

0 Answers0