Preserve large numbers
Digits and decimal zeroes remain unchanged.
cURL
curl --fail-with-body --request POST 'https://www.base64.sh/api/v1/json-formatter/' \
--user-agent 'Base64.sh API example/1.0' --header 'Content-Type: application/json' \
--data-raw '{"text":"{\"id\":9007199254740993,\"amount\":2.370}"}'
JavaScript
const response = await fetch("https://www.base64.sh/api/v1/json-formatter/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"text": "{\"id\":9007199254740993,\"amount\":2.370}"
})
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
Python
import json
from urllib.request import Request, urlopen
payload = json.loads("{\n \"text\": \"{\\\"id\\\":9007199254740993,\\\"amount\\\":2.370}\"\n}")
request = Request(
"https://www.base64.sh/api/v1/json-formatter/",
data=json.dumps(payload, ensure_ascii=False).encode("utf-8"),
headers={"Content-Type": "application/json", "User-Agent": "Base64.sh API example/1.0"},
method="POST",
)
with urlopen(request, timeout=15) as response:
print(json.load(response))
Response · HTTP 200
{
"ok": true,
"data": {
"result": "{\n \"id\": 9007199254740993,\n \"amount\": 2.370\n}",
"stats": {
"keys": 2,
"maxDepth": 1
}
}
}