> ## 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 FieldMask Is a String in JSON (and a List Everywhere Else)
- URL: https://datajutsu.com/protobuf-fieldmask-json/
- Published: 2026-10-22T12:46:50.000Z
- Updated: 2026-10-22T12:46:50.000Z
- Author: Data Jutsu

A FieldMask is how an API says which fields a patch touches or which fields a read should return, and the type itself is the least interesting part in protobuf: one field, paths, a repeated string at number one. I put a mask with two paths in a message and watched the wire. Each path went out as a plain length-delimited string, 0a03 612e62 and 0a01 63, and nothing else. No escaping, no structure, no marker that these strings are supposed to be dot-separated field paths. The whole path grammar is a convention between the two ends, and the wire carries it the way the wire carries everything: as bytes that mean whatever the schema says they mean.

Because it is a convention, nobody checks it. I round-tripped a mask full of junk: an empty string, a path with two dots, one in capitals, x\[0\].y, a bare dot, one with a trailing space, and the same path twice. Every one of them came back exactly as I sent it. A path that points at nothing does not fail anywhere in the toolchain; it just does nothing on the other side, which is a quieter failure than most. The wire cannot tell you the mask is wrong, because on the wire it is just a list of strings, and a list of strings is never wrong.

The JSON side is where the FieldMask is the odd one out in the well-known family. Every other WKT's official JSON form is an object. The FieldMask's is a string: the paths joined with commas, a.b,c. That is the form the mapping specifies, and that is the form the library does not take. Feed the official joined string into a mask field position and the encoder throws object expected, loud and immediate, the same way the wrappers and the Timestamp behave. Feed the exact same string to the mask by itself, at the top level, and it encodes to zero bytes with no complaint: the paths are gone and the round trip succeeds. Same input, two different doors, depending on where you hand it over.

There is a third act. Put a plain array where a mask field is expected, and nothing throws, but the wire gets the present-but-empty marker, the field tag with a length of zero, and the decode comes back with a mask that is there and holds nothing. So the input side of this type has all three failure flavors the family is made of: the loud rejection the wrappers do, the silent loss the Any and the Struct do, and this middle one where the field announces itself and then is empty. The output side keeps the object form, paths as an array, not the joined string the mapping names, which is the gap the Timestamp and Struct posts cover.

The small behaviors are the ones that matter in a patch API. An empty mask writes zero bytes, and a null where a mask is expected writes the field as absent, so the two land on the same wire state on purpose: no mask means touch nothing, and the format can say it. I ran all of it in the browser with no protoc. Paste a file that imports field\_mask.proto and the type resolves on every tab of [proto.datajutsu.com](https://proto.datajutsu.com/?ref=datajutsu.com), and the raw decode tab shows the paths as the plain strings they are, which is the only check this type has. The wrappers post[the wrappers post](https://datajutsu.com/protobuf-wrapper-types/), is the loud-door sibling, and the Struct post[the Struct post](https://datajutsu.com/protobuf-struct-json/), the silent-loss one; this one is the family member that does both, in the same type, depending on which form you used.