This module adds a 'jsonify' method to every model of the ORM. It works on the current recordset and requires a single argument 'parser' that specify the field to extract.
Example of a simple parser:
In order to be consistent with the Odoo API the jsonify method always returns a list of objects even if there is only one element in the recordset.
By default the key into the JSON is the name of the field extracted from the model. If you need to specify an alternate name to use as key, you can define your mapping as follow into the parser definition:
If you need to parse the value of a field in a custom way, you can pass a callable or the name of a method on the model:
Also the module provide a method "get_json_parser" on the ir.exports object that generate a parser from an ir.exports configuration.
Further features are available for advanced uses. It defines a simple "resolver" model that has a "python_code" field and a resolve function so that arbitrary functions can be configured to transform fields, or process the resulting dictionary. It is also to specify a lang to extract the translation of any given field.
To use these features, a full parser follows the following structure:
One would get a result having this structure (note that the translated fields are merged in the same dictionary):
Note that a resolver can be passed either as a recordset or as an id, so as to be fully serializable. A slightly simpler version in case the translation of fields is not needed, but other features like custom resolvers are:
By passing the fields key instead of langs, we have essentially the same behaviour as simple parsers, with the added benefit of being able to use resolvers.
Standard use-cases of resolvers are: - give field-specific defaults (e.g. "" instead of None) - cast a field type (e.g. int()) - alias a particular field for a specific export - ...
A simple parser is simply translated into a full parser at export.
If the global resolver is given, then the json_dict goes through:
Which allows to add external data from the context or transform the dictionary if necessary. Similarly if given for a field the resolver evaluates the result.
It is possible for a target to have a marshaller by ending the target with '=list': in that case the result is put into a list.
Would result in the following JSON structure:
The intended use-case is to be compatible with APIs that require all translated parameters to be exported simultaneously, and ask for custom properties to be put in a sub-dictionary. Since it is often the case that some of these requirements are optional, new requirements could be met without needing to add field or change any code.
Note that the export values with the simple parser depends on the record's lang; this is in contrast with full parsers which are designed to be language agnostic.
NOTE: this module was named base_jsonify till version 14.0.1.5.0.
auto_awesome What this module does
AI-generated from the code · Odoo 18.0Adds a JSON export engine to Odoo: any record can be converted to JSON using configurable export definitions, with per-field custom resolvers and language handling.
This module gives Odoo a generic way to turn records into JSON, mainly for integrations and data feeds.
- A new "Export Resolver" screen (menu under Settings) lets you store small Python snippets that transform a field value or a whole JSON result before it is returned.
- The existing "Export Fields" screen is extended: each export line can now define a target name, a language, a custom resolver, or a function name, and the export itself can use a global resolver and a language-agnostic option.
- Business rules: a line cannot have both a resolver and a function (validation error); the target path must have the same depth and reference the same fields as the source path.
- Automatic behaviour: dates and datetimes are converted to ISO text, many2one/reference fields become their display name, one2many/many2many become lists of display names, and false values become null (except booleans).
- It touches
ir.exports,ir.exports.line, the newir.exports.resolvermodel, and the base model, adding ajsonifymethod available on every model. - Access to the new resolver model is restricted to system administrators.
Depends on
Required by other modules
Menus it adds
Models and fields (4)
- base · extends an existing model
- ir.exports · extends an existing modellanguage_agnostic, global_resolver_id (Custom global resolver)
- ir.exports.line · extends an existing modelactive, target, lang_id (Language), resolver_id (Custom resolver), instance_method_name (Function)
- ir.exports.resolver · new modelname, type, python_code
Text generated by AI (DeepSeek) from reading the Odoo 18.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub
Availability by version
Reviewed: 2026-11-03Confirmation status: 5 confirmed, 4 with no information of 9 versions.
Sources · Odoo 15.0
Confirmed on 2026-11-03 in branch 15.0 of OCA/server-tools.
terminal Installation and usage
OCA documentation · Odoo 18.0Usage
Source · Odoo 18.0with_fieldname parameter
The with_fieldname option of jsonify() method, when true, will inject on the same level of the data "_fieldname_\$field" keys that will contain the field name, in the language of the current user.
> Examples of with_fieldname usage:
# example 1
parser = [('name')]
a.jsonify(parser=parser)
[{'name': 'SO3996'}]
>>> a.jsonify(parser=parser, with_fieldname=False)
[{'name': 'SO3996'}]
>>> a.jsonify(parser=parser, with_fieldname=True)
[{'fieldname_name': 'Order Reference', 'name': 'SO3996'}}]
# example 2 - with a subparser-
parser=['name', 'create_date', ('order_line', ['id' , 'product_uom', 'is_expense'])]
>>> a.jsonify(parser=parser, with_fieldname=False)
[{'name': 'SO3996', 'create_date': '2015-06-02T12:18:26.279909+00:00', 'order_line': [{'id': 16649, 'product_uom': 'stuks', 'is_expense': False}, {'id': 16651, 'product_uom': 'stuks', 'is_expense': False}, {'id': 16650, 'product_uom': 'stuks', 'is_expense': False}]}]
>>> a.jsonify(parser=parser, with_fieldname=True)
[{'fieldname_name': 'Order Reference', 'name': 'SO3996', 'fieldname_create_date': 'Creation Date', 'create_date': '2015-06-02T12:18:26.279909+00:00', 'fieldname_order_line': 'Order Lines', 'order_line': [{'fieldname_id': 'ID', 'id': 16649, 'fieldname_product_uom': 'Unit of Measure', 'product_uom': 'stuks', 'fieldname_is_expense': 'Is expense', 'is_expense': False}]}]No verified information in OCA: Installation, Configuration.
Installation instructions, the distribution package, dependencies and configuration steps are not shown because they have not yet been verified in the module documentation for any version.
Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.