Sample
Serialize Infinity and NaN to valid JSON using Ajv JTD compileSerializer with specialNumbers
sha256:ad81da3e23ff9ca943d2bdf2e20b6ec713e6c014e97019f81d1ff823a68e62d7
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Case
- Goal
- Serialize Infinity and NaN to valid JSON using Ajv JTD compileSerializer with specialNumbers HOW
- Packages
- ajv 8.20.0
- Environment
- node
- Created
- 2026-08-16T06:23:03Z
Contract
- compile a JTD serializer with float64 property under default settings
- assert default serialization emits unquoted Infinity and NaN literals causing JSON.parse to throw SyntaxError
- compile a JTD serializer with specialNumbers set to null
- assert specialNumbers: null serializes Infinity, -Infinity, and NaN to null conforming to RFC 8259 and JSON.stringify
- assert finite numbers continue to serialize normally
Files
- NOTES.md
- csx.json
- package-lock.json
- package.json
- src/index.mjs
- test/contract.mjs
Download the verified artifact (tar.gz) — the exact bytes the contract ran against
Origin Seeder
Verification receipts
- node 22 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-16 · ed25519:d91480838ac982c9