> ## Content Index
> Fetch the complete content index at: https://datajutsu.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# The Protobuf Timestamp Is Just Two Numbers (Until JSON Gets a Vote)
- URL: https://datajutsu.com/protobuf-timestamp-json/
- Published: 2026-10-22T03:56:24.000Z
- Updated: 2026-10-22T03:56:24.000Z
- Author: Data Jutsu

A Timestamp field in a .proto does not get a special wire encoding. It is a nested message with two fields: seconds, a sixty-four-bit integer as field one, and nanos, a thirty-two-bit integer as field two. Encode an Order that carries one and the block that goes out is a length-delimited pair of varints, nothing more. A stream from 2025-10-22 at midnight plus five hundred million nanoseconds serializes as the tag for field two, then its length, then the seconds varint and the nanos varint inside. A decoder without your schema sees a nested message with two whole numbers, and that is all the bytes say. The name Timestamp is a label your .proto puts on a pair, in the same way the map is a label on a list of pairs.

The place where a Timestamp is actually special is the JSON mapping, and it is the one type in the whole spec where the JSON side changes shape. The official mapping says a Timestamp goes out as an RFC3339 string, a date and a time and a Z, the moment rendered as text. So the wire carries a two-field message, the spec says the JSON carries a string, and the conversion between those two is a decision the spec made, not a property the format has. Every other field type keeps its shape across that conversion. A number stays a number, a string stays a string, and only the well-known types get remapped, and the Timestamp is the one that becomes a different kind of thing entirely.

Which is exactly why the tooling disagrees with each other. The library I use on the converter, protobufjs, does not render the string form at all: decode a message with a Timestamp in it and the JSON comes out as an object with a seconds field and a nanos field, seconds as a decimal string because it is sixty-four bits, nanos as a plain number. And the input side is a one-way door: hand it the RFC3339 string the spec says is the JSON form and it refuses with an object expected error, it only accepts the object form. So data serialized to the official mapping shape by a compliant library can be rejected by a tool that only speaks the object shape, and neither one is wrong about what it speaks. The other rules are in my post on the JSON mapping, and this is the rule where the shapes split.

The pair also skips the checks you would expect a timestamp to have. Nanos is not required to stay under a billion: I put two billion into it, encoded, decoded, and it came back as two billion, a value no timestamp can actually hold, with no error anywhere in the path. Seconds does not have to be positive either, so a pre-1970 moment carries as a negative varint, and a negative one signs out as a ten-byte sequence in the way any negative sixty-four-bit integer does on the wire, which is the same failure mode as the negative int32 in the wire format post. The wire is honest about all of it. It just does not judge it.

Step back and the pattern is the same one the map field showed. An int64 epoch, which is what most services used for dates before they adopted the well-known type, goes out in JSON as a decimal string. A Timestamp goes out, per the spec, as a date string. Both are numbers that look like text on the JSON side, and which one you see depends on the label in the schema, not on anything in the bytes. If your service is still on the epoch int64 and someone proposes the migration to a Timestamp field, the wire change is adding a nested message, and the JSON change is a string to a different string, which is the review line to argue about, not the bytes.

All of it runs in the browser with no protoc. Paste a .proto that imports the timestamp file, encode an order with a timestamp in it, and watch the length-delimited block come out field by field. Decode a stream that carries one and see the object form instead of the string. The raw decode tab at [proto.datajutsu.com](https://proto.datajutsu.com/?ref=datajutsu.com) shows the pair as a plain nested message before the schema gets a vote, which is the fastest way to see that the timestamp was never in the bytes either. The mapping rules it is compared against are in [the JSON mapping post](https://datajutsu.com/protobuf-json-mapping/).