Forum Discussion
Thanks for looking into it. One followup question. When I tried this, it is double quoting even numbers :
Any help on this?
In the arrow function, you’ll probably want to use parseFloat() to attempt to convert the string to a number. If parsing the string fails, a NaN will be returned, so you can use a logical-or operator to fallback to the original value. Here it is in code:
parseFloat(value) || value
Here is the updated expression:
jsonPath($.mapValues((value, key) => { value: parseFloat(value) || value, id: parseInt(key.match(/\d+/)[0]) }), "$*")