Exporting and Importing Object Definitions
Liferay 7.4 U68+/GA68+
You can export and import object definitions as .json
files. These files include the definition’s complete schema (e.g., configurations, fields, actions, and relationships).
When exporting definitions with relationships, the JSON file includes all relationships defined in the current object, as well as many-to-many relationships defined in other objects. However, the file does not include one-to-many relationships defined in other objects.
You can also export and import object entries together with their definitions and relationships in LAR files, along with other content.
If an imported definition references picklists or objects that do not exist, Liferay automatically generates them using the external reference codes provided in the exported JSON.
You can use a batch client extension to help migrate object definitions between Liferay environments, using previously exported JSON files. See Batch Client Extensions for more information.
Exporting Definition JSON
-
Open the Global Menu (
), go to the Control Panel tab, and click Objects.
-
Under Object Folders, select the folder including your desired object definition.
-
Click Actions (
) for the desired object and select Export Object Definition.
The object definition downloads as a JSON file. Once exported, you can import the object definition into compatible Liferay environments.
Importing Definition JSON
-
Open the Global Menu (
), go to the Control Panel tab, and click Objects.
-
Under Object Folders, select the folder where you want to import the object definition.
-
Next to the object folder name at the top of the screen, click Actions (
) and select Import Object Definition.
-
Enter a name for the object. You can edit this value after importing.
ImportantObject names must be unique and use PascalCase.
-
Select a JSON file to import.
Once selected, the modal window displays the definition’s external reference code (ERC). You can edit the ERC after importing.
-
Click Import.
The object definition begins importing in the background and can take a few minutes.
Exporting/Importing via LAR File
Liferay 2025.Q2+/GA135+
Exporting and importing instance-scoped object entries requires a developer feature flag. Set feature.flag.LPD-35914=true
to enable the Export and Import options in the Applications menu.
You can also move object entries and their relationships between sites or Liferay instances via LAR exports and imports. Export or import instance-scoped objects from the Export and Import links in the Applications menu (), and export or import site-scoped objects from the site menu.
Local live and remote staging do not support publishing objects.
Select the object definitions under Content to export its entries. You can also replicate deletions in your LAR export by selecting Export Individual Deletions in the configuration menu. Any object entries with these definitions, as well as their relationships, are included in the data in the LAR file.
You can use the exported LAR file to import the object entry data via the Import menu in another site or Liferay instance. When you import the LAR file, the target Liferay instance must also have the included object definitions already present, or an error occurs when you select the file.
To make sure both Liferay instances have the same object definition (including an identical class name), export and import the necessary definitions as JSON before you attempt the LAR import.