Skip to content
UniKit

JSON Strings to Numbers

Convert numeric-looking JSON strings into real numbers while leaving values with units, scientific notation or a plus sign untouched, and report the conversion count. Parsing stays in your browser.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

JSON input

Only strings made purely of digits (optional sign and decimal point, surrounding spaces allowed) are converted; 12px, 1e3 and +1 stay as strings.

Converted JSON

Only numeric strings change; other types and key names are untouched, and the count reflects real conversions.

Paste JSON to see the converted result

What this tool does

  • Turn amounts and quantities that arrived as strings back into numbers for arithmetic
  • Fix JSON exported from CSV where every number came back quoted

Example

Input

{"age":"37","price":"19.90"}

Output

{
  "age": 37,
  "price": 19.9
}

19.90 becomes the number 19.9 — JSON numbers do not keep trailing zeros.

Frequently asked questions

Which strings are converted?

Only strings that are entirely numeric: an optional minus sign, digits with an optional decimal part (or a leading dot such as .5), plus surrounding spaces. Values with units (12px), scientific notation (1e3) and a plus sign (+1) stay strings.

Can precision change?

Yes. Numbers are IEEE-754 doubles, so 19.90 becomes 19.9 and 9007199254740993 becomes 9007199254740992 (anything above 2^53-1 is rounded). Keep such values as strings instead.

Are key names converted?

No. Keys always stay strings, even when they look numeric ({"1":"2"} converts only the value).

Is there a conversion count?

Yes, the result panel shows how many strings were actually converted; unrecognised strings are not counted.

Keywords:json strings to numbersjson number cast

Related tools