Convert to number parser
Configuration options
Convert to number has no configuration options. It changes a value that is a plain number from text to a numeric value.
Store numbers as numbers in JSON
Use Convert to number when the data is consumed as JSON, for example through the API or a JSON export, and the receiving system expects numbers rather than text.
Source:
"12.50"
Result in JSON:
12.5
Plain numbers are converted, including values with leading zeros, surrounding spaces, a minus sign or exponent notation:
"12" → 12
"0012" → 12
" 42 " → 42
"-3.5" → -3.5
"1e3" → 1000
Values that are not converted
A value that contains anything other than the number is not converted and stays text:
$12.99
1,234.56
3,5
12 reviews
Remove extra characters first
Use Replace text to remove currency signs, thousands separators and words, then add Convert to number.
Example source:
$1,234.56
Configuration of the Replace text parser:
Text to replace: [^0-9.-]
Text to place:
Use Regex: Yes
Result in JSON after Convert to number:
1234.56
For values that use a comma as the decimal separator, replace the comma with a period before converting. If the same values also use periods as thousands separators, remove those periods first.
The CSV preview shows no change
CSV has no separate number type, so the CSV/XLSX preview shows the value unchanged. Switch the Parser preview to JSON to see the converted value.
Parser order
Place Convert to number after the parsers that clean the value.
Raw value
→ Regex match
→ Replace text
→ Convert to number
Convert to number and Basic math expression
Basic math expression already returns a number, so Convert to number is not needed after it.
Troubleshooting
- If a value stays text in the JSON preview, look for remaining currency signs, thousands separators, decimal commas or words.
- Use the preview with Show 100 records to find the records that are not converted.