Forum Discussion
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]) }), "$*")
I appreciate the prompt response and it worked. You saved me again 🙂
- bill_sturdivant8 years agoNew Contributor III
This worked great! Thanks!