Snipget.ai

Numbers parse float

Exact
numbers_parse_float

Deterministic and authoritative — the canonical answer for this input.

Parse a float from messy input. Handles thousand separators, whitespace, currency symbols, and native true/false (→ 1.0/0.0; the words 'true'/'false' are not numbers and return null). Processing multiple inputs? Use `numbers_parse_float_batch` to do up to 1000 in one call.

Parameters

valuestringrequired

Value to parse. Accepts any JSON type.

Call it

curl -X POST https://api.snipget.ai/v1/numbers/parse/float \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"value":"1,234.5"}'

The Batch tab sends up to 1000 inputs in one call via /v1/numbers/parse/float/batch.

Example response

{
  "input": "1,234.5",
  "parsed": 1234.5,
  "ok": true
}

FAQ

Why not just convert the text to a number myself?

Messy values like '1,234.5' with thousand separators or stray spaces trip up a plain number conversion. This strips the commas and whitespace and gives you a clean float, handling the everyday spreadsheet and export quirks for you.

What kinds of input does it accept?

Plain numbers, digit strings, strings with comma thousand separators, a leading or trailing currency symbol ('$1,234.56'), and values with extra surrounding spaces. Native boolean values become 1.0 or 0.0 (the words 'true'/'false' are not numbers and return null). Empty or null-ish values return null.

What if the value can't be parsed?

It returns parsed as null with ok false and confidence 0, rather than an error. So a value like 'abc' fails cleanly and you can route it for review.

Is the result exact?

The parsing is deterministic, so the same input always returns the same value. Note that floats carry standard computer rounding, so use parse_integer when you specifically want a whole number.

Does it handle currency symbols or percent signs?

Currency symbols yes: one leading or trailing symbol ($, €, £, ¥ and similar) is stripped, so '$1,234.5' parses to 1234.5 and '-$5' keeps its sign. Percent signs and ISO codes like 'USD 5' are not handled - strip the % yourself, and use the money bucket's currency tools for real money parsing.

Related tools