> ## Documentation Index
> Fetch the complete documentation index at: https://read.sqwish.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Canonical JSON and money

> JSON serialization and billing arithmetic.

Use these rules when comparing request bodies or computing charges.

Object context uses [RFC 8785 JSON canonicalization](https://www.rfc-editor.org/rfc/rfc8785):
recursive object-key sorting by UTF-16 code units, preserved array order, compact
UTF-8 output, and ECMAScript number formatting. Strings retain their Unicode
contents without normalization. Quotes, backslashes, and controls are escaped;
other Unicode characters remain unescaped. For example `1.0` becomes `1`, `-0.0`
becomes `0`, and `1e-7` remains in exponent notation.

D1 additionally rejects integer magnitudes above `9,007,199,254,740,991`. The
restriction also applies to integral floating-point values: `9007199254740992`,
`9007199254740992.0`, and `1e20` are all rejected. Use a JSON string for identifiers,
large integers, or decimal values requiring exact precision. Accepted fractional
numbers use binary64 semantics; their decimal spelling can round during parsing.
Duplicate decoded object keys, NaN/infinity, malformed UTF-8, unpaired surrogates,
and nesting deeper than 32 levels are rejected. These rules apply to the complete
request, including nested context.

Charges round up once per request. At a synthetic tariff of
500,000 nano-USD per million tokens, three tokens cost two nano-USD. Rounding each
token separately would incorrectly charge three. Money is returned with exactly
nine decimal places; sub-nano-USD precision and negative purchase amounts are
rejected.

This describes serialization and rounding. Tokenizer counts and model latency
depend on the active release.
