Skip to main content
iVentureTeam

json

The json widget renders a JSON field as formatted, read-only text. It takes no options at all, and you almost never write it in a view, because Odoo applies it automatically to every json field.

September 18, 2026Updated September 18, 20264 min read
Technical namejson
Field typesjson
Viewsform, list
Moduleweb, present in every Odoo database
Used in core0 explicit widget="json" attributes in Odoo 19 Community or Enterprise. It still renders on every json field through the type fallback described below.
VersionsOdoo 19.0, Odoo 20.0
No-code setupNo. This widget has no Studio entry and no options to configure.
Alternativestext, code, properties, contact_statistics

What the json widget does

The json widget takes the value of a json field and prints it as formatted text. The whole component is a few lines long: it reads this.props.record.data[this.props.name], passes it through the shared formatJson formatter, and renders the result.

There is no input element. The user can read the value and copy it, and that is all. If you need an editable JSON blob, this is the wrong widget.

It declares supportedTypes: ["json"] and no supportedOptions key at all. That is not an oversight in our reading: the descriptor object in the source has exactly three keys, component, displayName and supportedTypes.

What this means for your team

If your team can see a raw JSON blob on a form, something technical is being surfaced deliberately: a stored API response, a computed structure, a debugging aid. The useful thing to know is that nobody can break it by typing in the wrong place, because there is nothing to type into.

The flip side is that a json field is not a reporting field. It does not group, it does not filter usefully, and it does not export in a shape a spreadsheet will like. If people are reading data out of a JSON blob by eye, that data wants to become real fields.

Working examples

You rarely need to write this at all. A json field with no widget attribute already renders through this widget:

<field name="payload"/>  <!-- a json field: the json widget is applied automatically -->

Writing it explicitly changes nothing, but is harmless and self-documenting:

<field name="payload" widget="json"/>

Why this widget has zero recorded uses and still renders everywhere

We counted every widget="json" attribute in Odoo 19 Community and Enterprise. The answer is zero. That looks like a dead widget until you read how Odoo picks a component.

In addons/web/static/src/views/fields/field.js, getFieldFromRegistry ends with this line:

return findInRegistry(fieldType) || { component: DefaultField };

When a field carries no widget attribute, Odoo looks up the fields registry using the field type name as the key. The json widget is registered under the key json, and the field type is also called json, so every json field in every view resolves to this widget without anyone writing it down.

The same function holds a second detail worth knowing on any widget page. When you do pass a widget whose supportedTypes does not include the field's type, Odoo does not raise an error. It logs a console warning and renders the widget anyway:

console.warn(`The widget: ${widget} don't support the type ${fieldType}`);

So a mismatched widget fails quietly in the browser console rather than loudly on screen. If a field looks wrong and the server logs are clean, open the browser console before anything else.

Version compatibility

VersionStatusNotes
Odoo 19.0VerifiedVerified against the shipped 19.0 source.
Odoo 20.0VerifiedVerified against the 20.0 branch. No changes.

The widget has been stable for several releases. We verified the 19.0 and 20.0 branches directly and the descriptor is byte-for-byte the same shape: no options added, no options removed, no registration changes.

What is changing in Odoo 20

Nothing changes. We diffed the 20.0 branch against 19.0 and the json registration is identical: same component, same supportedTypes, still no options.

That is worth stating plainly because a lot of the Odoo 20 widget release is not stable. Roughly 48 widgets changed options or types between the two branches. This one did not.

Common problems and fixes

SymptomCause and fix
The field shows nothing at allThe stored value is null or an empty object. The widget renders whatever formatJson returns and adds no placeholder. Check the stored value on the record. An empty json field is legitimately blank.
Users cannot edit the valueWorking as designed. The json widget has no input element. Use a text field with the code widget for an editable blob, or split the data into real fields.
An options dictionary on the field appears to be ignoredIt is ignored. This widget declares no supported options and reads none. Remove the options attribute. If you need configurable rendering, you need a custom widget.

Json widget vs the alternatives

WidgetBest forKey difference
jsonRead-only display of an opaque JSON payloadNo options and no input: it prints the value and stops
textLong free text a user must editEditable, with no JSON formatting
codeAn editable blob with syntax highlightingAce editor, takes a mode option, works on text and html fields
propertiesPer-record custom fields users define themselvesStructured and editable, with a real field definition behind it
contact_statisticsA json field holding a list to display as statisticsAlso json and read-only, but renders a list rather than raw text

The honest recommendation is that a JSON blob on a form is usually a symptom. If users need to read three values out of it, those three values want to be stored fields, where they can be searched, grouped, exported and reported on. Use json for the cases where the structure really is opaque payload: a webhook body you keep for audit, a provider response you may need to replay.

Frequently asked questions

Can I edit a json field in Odoo?+
Not through the json widget. It has no input element and is display-only. To edit a blob, put it on a text field and use the code widget, or split the data into real stored fields.
Why does my json field render without a widget attribute?+
Because Odoo falls back to the registry entry whose key matches the field type. A field of type json with no widget resolves to the widget registered as json. This happens in getFieldFromRegistry in field.js.
Does the Odoo json widget have any options?+
No. The descriptor declares no supportedOptions and the component reads nothing from the options dictionary. Anything you pass is parsed and discarded.
Does the json widget change in Odoo 20?+
No. We diffed the 19.0 and 20.0 branches and the registration is unchanged: same component, same supported types, still no options.

A JSON blob where fields should be?

Opaque payloads on a form usually mean data is being stored in a shape nobody can report on. We model it properly: real fields, real filters, real exports, without losing the raw payload you keep for audit. Odoo 16 through 19, and we are already testing against 20.

Talk to an Odoo consultant

How this page was produced

Verified by reading addons/web/static/src/views/fields/json/json_field.js on the 19.0 branch of a local clone of the official Odoo repository, then diffing the same file and registration against the 20.0 branch. The usage count comes from a scan of every XML file in Community and Enterprise, including odoo/addons/base, counting widget="json" attributes. The type fallback behavior was read in getFieldFromRegistry in addons/web/static/src/views/fields/field.js. If you find something here that does not match your database, tell us and we will correct it and say so.