15 min read
JSON vs Protobuf: how to serialize API data
In one sentence: Serializing is turning your program's data into bytes so they can be sent. JSON, the format of almost every API, has no dates, money or big integers: how to write them is up to you, and it's part of the contract. Protobuf, a binary format, takes less space, but without its schema it can't be read.
What you will learn
- Explain what serializing is and which kinds of data JSON has, and which it doesn't.
- Send dates in ISO 8601 and in UTC, money in whole cents and big ids as text, and tell null apart from a field that isn't there.
- Read a Protobuf message byte by byte and compare it with the same order in JSON.
- Decide when a binary format pays off and when to stick with JSON.
Before you start, read: 05-openapi.md
The problem
Section titled “The problem”The delivery company that uses the shop’s API asks for a new piece of data: when each order was placed, so they can deliver the oldest ones first. Imagine you add it the way you’d write it by hand: "date": "03/10/2026 11:30".
Their program has to guess two things. Is it October 3, or March 10, the way a program in the United States would read it? Is it 11:30 in Madrid, or in Bogotá, where the company has its office? The text doesn’t say.
And that’s not the only trap: the mobile app adds up a cart, €8.50 + €0.10 + €0.20, and gets 8.799999999999999. The data is fine on your server; it gets spoiled when it’s converted to travel, or when it’s read on the other side.
The analogy
Section titled “The analogy”The analogy
Imagine you’re shipping a wardrobe with a courier. It won’t fit in the van in one piece: you take it apart, put the pieces in a box and, when it arrives, someone puts it back together.
You can label each piece with its name, “left door”: anyone understands the box, although the labels take up room. That’s JSON. Or you can number the pieces and send the manual separately: the box weighs less, but without the manual nobody knows what piece 4 is. That’s Protobuf, and the manual is its schema.
Where the analogy breaks down
- A wardrobe arrives just as it left. Some data doesn’t: a date leaves as a date and arrives as text, and a very big number, with different digits, without anyone warning you.
How it really works
Section titled “How it really works”Serializing is turning data into bytes
Section titled “Serializing is turning data into bytes”You’ve already done it: in lesson 2 of Phase 3, JSON.stringify turned an object into text, and JSON.parse did the opposite. Every c.json(order) in your API does it for you.
That’s SerializationTurning data that lives in a program’s memory into bytes that can be sent over the network or saved in a file: JSON text, for example, or a binary format like Protobuf. On the other side, deserializing turns them back into data.Go to definition: turning the data in a program’s memory into bytes that can travel over the network or be saved in a file. Deserializing is the opposite. In JSON, each digit or unaccented letter is one byte.
Your server and the mobile app each store data in their own way, and they need a common format: in public APIs, almost always JSONJSON stands for JavaScript Object Notation.A format for writing data as text, with braces, quotes and colons: {"product":"mug","quantity":2}. People can read it, and so can almost any programming language, and it’s the most common format for the data that travels between a frontend and a backend.Go to definition.
JSON only knows six kinds of data
Section titled “JSON only knows six kinds of data”| Kind | Example |
|---|---|
| Text | "pending" |
| Number | 2, 8.5 |
| True or false | true, false |
| Nothing | null |
| ObjectA value that groups several pieces of data, each with its own name, such as { name: "Mug", price: 8.5 }. Each piece is read with a period and its name, such as product.price.Go to definition | {"id":7} |
| List (ArrayA list of values in order, such as [20, 8.5, 35]. Each value is read by its position, which starts counting at 0: prices[0] is the first one.Go to definition) | [1,2,3] |
There are no dates, no money, and no difference between whole numbers and decimals. You turn everything else into one of those six things yourself, and how you do it is part of your API’s contract. These are the most common traps.
Dates: ISO 8601 text, in UTC
Section titled “Dates: ISO 8601 text, in UTC”JSON.stringify turns a date into text, and JSON.parse doesn’t turn it back. Open the REPLREPL stands for Read-Eval-Print Loop.A way of working with a language in which you type a line of code, it runs and you see the result right away, without creating any file. In Node.js, you open it by typing node, with nothing else, in the terminal.Go to definition with node:
In the REPL: a date goes and comes back as text
const date = new Date('2026-10-13T09:30:00Z')const text = JSON.stringify({ createdAt: date })texttypeof JSON.parse(text).createdAtWhat you will see:
undefinedundefined'{"createdAt":"2026-10-13T09:30:00.000Z"}''string'new Date('…')creates a date from a text, andJSON.stringifywrites it as"2026-10-13T09:30:00.000Z": year, month and day; aT; the time with its milliseconds; and aZ.typeofsays what kind of data something is: on the way back,createdAtis a text. If the client wants a date, it creates one withnew Date(text).
The outputs in this lesson are from Node 26.
That format is ISO 8601, an international standard: it starts with the year, so nobody mixes up the day and the month. The Z means UTC, the reference time for the whole world, with no daylight saving time, and it’s what matters most. Look at the same text without it:
The same text, in two time zones
TZ=Europe/Madrid node -p "new Date('2026-10-13T09:30:00').toISOString()"TZ=America/Bogota node -p "new Date('2026-10-13T09:30:00').toISOString()"TZ=America/Bogota node -p "new Date('2026-10-13T09:30:00Z').toISOString()"What you will see:
2026-10-13T07:30:00.000Z2026-10-13T14:30:00.000Z2026-10-13T09:30:00.000ZTZ=… changes the time zone for that command only. node -p runs the JavaScript in quotes and prints the result, and toISOString() gives the date in UTC.
Without the Z, new Date understands “9:30 here”: 7:30 UTC in Madrid and 14:30 UTC in Bogotá. With the Z, the same everywhere.
Send dates in ISO 8601 and in UTC, with the Z. Each client converts them to its local time only to show them. That’s what the project does: in src/data.ts, the order has a new field:
// createdAt: when it was placed, as ISO 8601 text in UTC (the final Z): 2026-10-13T09:30:00.000Z.// JSON has no dates; this way any client, in any time zone, reads it the same.export interface Order { id: number; productId: number; quantity: number; status: OrderStatus; createdAt: string;}createdAt is a string, not a Date: what’s stored and what travels is a text. This is how it’s filled in:
// toISOString() always gives the date in UTC, whatever the server's time zone.export function createOrder(productId: number, quantity: number, createdAt = new Date()): Order { const order: Order = { id: orders.length + 1, productId, quantity, status: 'pending', createdAt: createdAt.toISOString(), }; orders.push(order); return order;}createdAt = new Date() is a default value: if it isn’t passed, it’s the current time.
And in src/schemas.ts, the schema that becomes the contract from lesson 5:
export const orderSchema = z .object({ id: z.number().int().openapi({ example: 7 }), productId: z.number().int().openapi({ example: 1 }), quantity: z.number().int().openapi({ example: 2 }), status: z.enum(['pending', 'paid', 'shipped', 'cancelled']), // A date and time in ISO 8601: in the contract it shows up as a string with format: date-time. createdAt: z.iso.datetime().openapi({ example: '2026-10-13T09:30:00.000Z' }), }) .openapi('Order');z.iso.datetime() means “a text with a date and time in ISO 8601.” In openapi.json it shows up as "type": "string" with "format": "date-time": whoever reads the contract knows what to expect.
Money, in whole cents
Section titled “Money, in whole cents”The second problem from the beginning, in examples/money.ts:
// Numbers with decimals are stored in binary, and 0.1 has no exact form in binary (just as 1/3// has none in decimal: 0.3333…). The closest one is stored, and the errors add up.console.log('0.1 + 0.2 =', 0.1 + 0.2);console.log('Is 0.1 + 0.2 equal to 0.3?', 0.1 + 0.2 === 0.3);
// A €8.50 mug, a €0.10 sticker and a €0.20 badge.const totalInEuros = 8.5 + 0.1 + 0.2;console.log('\nIn euros:', totalInEuros);The math in money.ts
node examples/money.tsWhat you will see:
0.1 + 0.2 = 0.30000000000000004Is 0.1 + 0.2 equal to 0.3? false
In euros: 8.799999999999999In cents: 880To show it: €8.80Notice the false: 0.1 + 0.2 isn’t 0.3. And the mug, the sticker and the badge add up to 8.799999999999999. It isn’t a JavaScript thing: Python or Java give the same.
The comment in the code explains it: in binary, 0.1 has no exact form, just like 1/3 in decimal (0.3333…). The solution is not to use decimals:
// In cents, everything is a whole number: the sums are exact.const totalInCents = 850 + 10 + 20;console.log('In cents:', totalInCents);
// Only when it's shown is it turned into euros, with each language's format.const euros = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'EUR' });console.log('To show it:', euros.format(totalInCents / 100));- In cents, everything is a whole number, and adding whole numbers is exact:
850 + 10 + 20is880, always. Intl.NumberFormatwrites a number the way each language expects it: with'en-US'and the euro,€8.80.
Money travels in whole cents, and is turned into euros only to show it. That’s why version 2 of the shop (lesson 4) changed "price": 8.5 to "priceCents": 850, and version 1 translates with Math.round, because 8.29 * 100 gives 828.9999999999999. Payment APIs do the same: in Stripe, "amount": 1099 is $10.99.
Whole numbers beyond 2⁵³
Section titled “Whole numbers beyond 2⁵³”JavaScript stores every number the same way, with room for about 16 digits. Up to 2⁵³ − 1, about nine quadrillion, every whole number is exact; above it, not:
In the REPL: an id that’s too big
Number.MAX_SAFE_INTEGERJSON.parse('{"id":9007199254740993}')JSON.parse('{"id":"9007199254740993"}')What you will see:
9007199254740991{ id: 9007199254740992 }{ id: '9007199254740993' }Number.MAX_SAFE_INTEGER is that limit. The id 9007199254740993 arrives as 9007199254740992, a different number, without any error. In quotes, as text, it arrives whole.
It happens for real: the ids of X (formerly Twitter) are 64-bit numbers, and its API sends them as text; its documentation explains it with this very JavaScript problem. Ids that can grow that big, or that come from another system, go as text. The shop’s are small and are still numbers.
null or missing: not the same thing
Section titled “null or missing: not the same thing”A field can be null or not be there. And JavaScript has undefined, which JSON doesn’t know:
In the REPL: null, undefined and a missing field
JSON.stringify({ id: 7, note: undefined, coupon: null })const order = JSON.parse('{"id":7,"coupon":null}')order.couponorder.noteWhat you will see:
'{"id":7,"coupon":null}'undefinednullundefinedJSON.stringify drops the fields that are undefined; null, on the other hand, travels. When reading, coupon exists and is null; note doesn’t exist, and gives undefined.
null says “this field exists and is empty”; a field that isn’t there says “I’m telling you nothing about this.” In a PATCH (Phase 2), {"phone": null} asks to delete the phone number, and {}, to leave it alone. If your API treats both the same, nobody can delete a phone number.
Decide what each field accepts and write it in the schema: in Zod, .optional() lets it be missing, and .nullable() lets it be null.
Field names are part of the contract too
Section titled “Field names are part of the contract too”In JSON, the names travel in every object. Pick a style and don’t mix them: the shop uses productId (camelCase), like JavaScript; GitHub, created_at (snake_case). Put the unit in the name if there’s any doubt, as in priceCents, and get it right the first time: changing a name breaks every client (lesson 4).
Protobuf: a schema, and bytes instead of text
Section titled “Protobuf: a schema, and bytes instead of text”ProtobufA format for serializing data in binary (bytes that aren’t text), created by Google; its full name is Protocol Buffers. The fields are described in a schema, a .proto file, and the bytes carry each field’s number instead of its name. It takes up less space than JSON, but without the schema it can’t be read.Go to definition (Protocol Buffers) is a binary format, made of bytes that aren’t text, created by Google. The data is described in a SchemaThe description of what some data must look like: which fields it has, whether each one is a number or text, and which values are accepted. A program compares the incoming data with it and says whether it matches or what’s wrong.Go to definition, a .proto file. This is the order, in examples/order.proto:
// The same order the API sends in JSON, described for Protobuf. Each field carries a number: the// bytes carry that number, not the field's name.syntax = "proto3";
package shop;
// An enum: in the bytes, the status is a small number, not a text like "pending".enum Status { STATUS_UNSPECIFIED = 0; PENDING = 1; PAID = 2; SHIPPED = 3; CANCELLED = 4;}
message Order { uint32 id = 1; uint32 product_id = 2; uint32 quantity = 3; Status status = 4; string created_at = 5;}enum Statusgives a number to each status.0is what’s read if the field isn’t there: that’s why it’sSTATUS_UNSPECIFIED, not a real status.message Orderdescribes each field with its type (uint32, a whole number with no sign) and its number. The names use underscores, by Protobuf custom.- The
= 1,= 2… isn’t a value: it’s the field’s number, and it’s what travels instead of the name.
To use it from Node you need a Package (of code)Ready-to-use code that someone publishes with a name and a version number, so others can install it in their projects instead of writing it. In Node.js, packages are installed with npm and kept in the node_modules folder.Go to definition, protobufjs:
Install protobufjs
npm install protobufjs@8.8.0What you will see:
added 2 packages, and audited 37 packages in 2s
6 packages are looking for fundingrun `npm fund` for details
found 0 vulnerabilitiesYour timings will be different.
The program that compares the two formats, examples/protobuf.ts, in three parts:
import { join } from 'node:path';import protobuf from 'protobufjs';
/** The bytes, in hexadecimal: two digits per byte. */const asHex = (bytes: Uint8Array) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join(' ');import.meta.dirname is this file’s folder, and join adds order.proto to it. asHex writes each byte in hexadecimal, which counts from 0 to 9 and then goes on from a to f: a byte, from 0 to 255, goes from 00 to ff.
The order in JSON:
const order = { id: 7, productId: 1, quantity: 2, status: 'pending', createdAt: '2026-10-13T09:30:00.000Z',};
// In JSON, the field names and the values travel, all as text.const asJson = Buffer.from(JSON.stringify(order));console.log(`JSON: ${asJson.length} bytes`);console.log(asJson.toString());Buffer.from turns the text into bytes, and .length counts them. And the same order in Protobuf:
// The schema says which fields there are, of what type and with what number. Without it, the// bytes can't be read.const schema = await protobuf.load(join(import.meta.dirname, 'order.proto'));const Order = schema.lookupType('shop.Order');
// protobufjs calls the fields productId and createdAt, even though in the .proto they're// product_id and created_at. The status goes with the enum's name.const message = Order.fromObject({ ...order, status: 'PENDING' });const asProtobuf = Order.encode(message).finish();console.log(`\nProtobuf: ${asProtobuf.length} bytes`);console.log(asHex(asProtobuf));
// And the other way round: with the same schema, the bytes become the order again.const decoded = Order.toObject(Order.decode(asProtobuf), { enums: String });console.log('\nRead from the bytes:', decoded);protobuf.loadreads the.proto; reading a file takes time, so it carriesawait(Phase 3).lookupTypelooks up theOrdermessage in it.fromObjectprepares a copy of the order that follows the schema, with the status as theenumcalls it, andencode(…).finish()serializes it: it gives the bytes.decodedoes the opposite, andtoObjectgives a normal object;{ enums: String }asks for the status by its name.
The same order, in JSON and in Protobuf
node examples/protobuf.tsWhat you will see:
JSON: 93 bytes{"id":7,"productId":1,"quantity":2,"status":"pending","createdAt":"2026-10-13T09:30:00.000Z"}
Protobuf: 34 bytes08 07 10 01 18 02 20 01 2a 18 32 30 32 36 2d 31 30 2d 31 33 54 30 39 3a 33 30 3a 30 30 2e 30 30 30 5a
Read from the bytes: {id: 7,productId: 1,quantity: 2,status: 'PENDING',createdAt: '2026-10-13T09:30:00.000Z'}93 bytes against 34, and when they’re read with the schema, the order comes back whole. If you get Cannot find package 'protobufjs', you still have to install it; if you get no such file, order.proto isn’t in examples/.
Those 34 bytes can be read by hand:
| Bytes | What they say |
|---|---|
08 07 |
Field 1 (id), a number: 7 |
10 01 |
Field 2 (product_id): 1 |
18 02 |
Field 3 (quantity): 2 |
20 01 |
Field 4 (status): 1, which is PENDING |
2a 18 |
Field 5 (created_at), a text of 18 bytes, which is 24 in decimal |
32 30 32 36 … |
2026-10-13T09:30:00.000Z, letter by letter: 32 is “2”, and 30 is “0” |
The first byte of each row is the field’s number times 8, plus 0 if it’s a number or 2 if it’s a text: field 5 gives 42, 2a. No names, no quotes, no braces: that’s where the savings come from. The date, on the other hand, is still text: 26 of the 34 bytes.
A program reading with an old .proto skips the field numbers it doesn’t know. That’s why adding a field with a new number breaks nobody, and a number that has been used is never reused.
When a binary format pays off
Section titled “When a binary format pays off”| JSON | Protobuf | |
|---|---|---|
| Reading it | At a glance, with curl or DevTools |
Only with the schema and a program |
| Size | Bigger: the names go in every object | Smaller: this order, a bit more than a third |
| Schema | Optional, like your OpenAPI | Required: the .proto |
| Where it’s used | Public APIs and websites | Between the services of one company |
Size is a bit misleading: responses are usually compressed before they travel (Phase 2), and what repeats most in JSON, the names, is what compresses best. You’ll measure it in “Try it.”
Protobuf pays off when you control both sides and the volume is huge: a company’s services that call each other thousands of times per second, almost always with gRPC (lesson 9). For an API used by people you don’t know, JSON: it can be read with curl, without asking you for the schema.
Try it
Section titled “Try it”The goal: for each order to say when it was placed, without breaking any client, and to measure how much space it takes. You start from your project from lesson 5, in ~/backend-course/phase-3/shop-api. If you get stuck, download this lesson’s folder and compare it with yours: from ~/backend-course/phase-3, curl -O https://backenddesdecero.com/practicas/shop-api/15-serialization.tar.gz and tar -xzf 15-serialization.tar.gz.
Add the date to the orders
Section titled “Add the date to the orders”- In
src/data.ts, replace theinterface Orderand thecreateOrderfunction with the ones from “Dates: ISO 8601 text, in UTC.” - In the same file, replace the sample orders with these:
// 25 sample orders, so there's something to paginate. The oldest ones are already shipped; the// ones in the middle, paid; the newest ones, pending. One every 7 hours from October 1st.const FIRST_ORDER = new Date('2026-10-01T09:00:00Z').getTime();const SEVEN_HOURS = 7 * 60 * 60 * 1000;for (let number = 1; number <= 25; number++) { const createdAt = new Date(FIRST_ORDER + (number - 1) * SEVEN_HOURS); const order = createOrder((number % 3) + 1, (number % 4) + 1, createdAt); if (number <= 12) order.status = 'shipped'; else if (number <= 20) order.status = 'paid';}One every seven hours from October 1 at 9:00 UTC: getTime() gives the date in milliseconds, and adding SEVEN_HOURS to it moves it seven hours forward. With fixed dates, your list comes out the same as here.
- In
src/schemas.ts, addcreatedAtto theorderSchemaschema, as above.
Start the server with npm run dev and, in another terminal, ask both versions of the API for the first order:
1. Order 1, in v2 and in v1
curl -w '\n' localhost:3000/v2/orders/1curl -w '\n' localhost:3000/v1/orders/1What you will see:
{"id":1,"productId":2,"quantity":2,"status":"shipped","createdAt":"2026-10-01T09:00:00.000Z"}{"id":1,"productId":2,"quantity":2,"status":"shipped","createdAt":"2026-10-01T09:00:00.000Z"}Both give createdAt: a new field breaks nobody, and there’s no need for a version 3. If it doesn’t show up, check that you saved data.ts and that the server restarted.
2. A new order, with the current time
curl -w '\n' --json '{"productId":2,"quantity":1}' localhost:3000/v2/ordersWhat you will see:
{"id":26,"productId":2,"quantity":1,"status":"pending","createdAt":"2026-10-13T15:39:11.027Z"}Your date and time will be different, and in UTC: in New York, four hours ahead of your clock in summer and five in winter.
The examples, and the compressed list
Section titled “The examples, and the compressed list”Create the examples/ folder with the three files from “How it really works,” install protobufjs if you didn’t, and run both examples: you should get the same numbers. Then restart the server (Ctrl + C and npm run dev), so that only the 25 sample orders are there, and measure the list:
3. The list of orders, uncompressed and compressed
curl -s 'localhost:3000/v2/orders?limit=50' | wc -ccurl -s 'localhost:3000/v2/orders?limit=50' | gzip | wc -cWhat you will see:
2343332wc -c counts the bytes that reach it through the PipeThe terminal’s | symbol: it connects two programs, so what the first one writes reaches the second one as input.Go to definition, and gzip compresses them first. On a Mac, wc writes spaces in front of the number, and gzip can be a few bytes off.
From 2343 bytes to 332. In Protobuf, those 25 orders would take about 900 uncompressed: 34 per order, and two more for being in a list. The compressed JSON takes less than the uncompressed Protobuf. That’s why size alone rarely justifies a binary format in a public API: it’s enough for your server, or its CDNCDN stands for Content Delivery Network.A network of servers spread around the world that serves a website from the one closest to each user, so the round trip is short. example.com sits behind Cloudflare’s.Go to definition, to compress the responses.
Challenge: in examples/protobuf.ts, delete the createdAt line from the order and run it again. Before you look: how many bytes do you think each format will take, and why?Show answer
JSON: 54 bytes{"id":7,"productId":1,"quantity":2,"status":"pending"}
Protobuf: 8 bytes08 07 10 01 18 02 20 01
Read from the bytes: { id: 7, productId: 1, quantity: 2, status: 'PENDING' }JSON goes down from 93 to 54 bytes, and Protobuf, from 34 to 8: the date was 26. Without text, Protobuf takes almost seven times less: it saves on names and numbers, not on text. Afterwards, put the line back: the tests count on it.
A test that’s too strict
Section titled “A test that’s too strict”Now, the tests you have from lesson 5:
4. The tests from before
npm testWhat you will see:
ℹ tests 51ℹ suites 0ℹ pass 50ℹ fail 1ℹ cancelled 0ℹ skipped 0ℹ todo 0ℹ duration_ms 2019.751872
✖ failing tests:
test at test/rest.test.ts:58:1✖ PATCH /orders/:id changes the quantity and returns the whole order (4.120161ms)AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:+ actual - expected
{+ createdAt: '2026-10-13T15:39:07.456Z', id: 27, productId: 1, quantity: 5, status: 'pending' }
at TestContext.<anonymous> (file:///Users/ana/backend-course/phase-3/shop-api/test/rest.test.ts:62:10)It’s a piece of the end of the output, with the Linux path replaced by a Mac one. Notice the line with +: a field the test didn’t expect, because it compared the whole order with deepEqual.
Your API hasn’t broken anything: the test was a client that’s too strict. It’s the rule from Phase 0: be strict with what you send and tolerant with what you receive. The new test compares the order without createdAt. Bring in the tests from this lesson’s folder, the one you downloaded at the beginning:
5. This lesson’s tests
cp -r ../15-serialization/test .npm testWhat you will see:
ℹ tests 57ℹ suites 0ℹ pass 57ℹ fail 0ℹ cancelled 0ℹ skipped 0ℹ todo 0ℹ duration_ms 1220.938046The end of the output: 57 tests and fail 0. Six are new, in test/serialization.test.ts, and two of them run your examples: if they fail, compare your examples/ with the one in the download.
You have already seen it
Section titled “You have already seen it”- Apps that say “5 minutes ago” or show a message’s time in your time zone: the server usually sends the date in UTC, and the app converts it to your time.
- Prices in online stores. In the Network tab of DevTools (how to open them), many of them answer with amounts in cents, like
1999, and the page writes “$19.99”.
Common mistakes
Section titled “Common mistakes”- Dates without a time zone, like
"2026-10-13 11:30": each client reads them in its own time. - Money with decimals: tiny errors that add up.
- Big ids as numbers:
JSON.parserounds them without warning. - Treating
nulland a missing field the same. In aPATCH, one deletes and the other leaves things alone. - A client that compares the whole response: it fails with every new field.
- Moving to Protobuf to save bytes without compressing the responses first.
Summary
Section titled “Summary”- Serializing is turning data into bytes. JSON has no dates, money or big integers: how you write them is part of the contract.
- Dates in ISO 8601 and in UTC, with the
Z; money in whole cents; huge ids, as text. nulland a missing field are different things, and a client ignores the fields it doesn’t know.- Protobuf sends field numbers instead of names: the order goes from 93 to 34 bytes, but without the
.protoit can’t be read. - For a public API, compressed JSON; a binary format, between your own services with a lot of traffic.
Did you get it?
Section titled “Did you get it?”To review:
Further reading
Section titled “Further reading”- RFC 8259: the JSON standard; section 6, on big numbers.
- RFC 3339: ISO 8601 dates in internet protocols.
- Date.prototype.toISOString() and Number.MAX_SAFE_INTEGER (MDN).
- Floating Point Math:
0.1 + 0.2in dozens of languages, and why. - Protocol Buffers: Encoding: a message’s bytes, field by field.