<-- Back

How to export the Mendix app model

Introduction

This article describes approaches to exporting the Mendix app model to a JSON or Excel file.

Environment

Studio Pro (all versions)

Instructions/Procedure

Option 1: Using the mx dump-mpr command

Instructions:

  1. Run Command Prompt as administrator.
  2. Go to the folder where the executable mx.exe file is located. It is the same folder that contains studiopro.exe (for example, C:\Program Files\Mendix\11.0.0.5003\modeler\mx.exe).
  3. Execute the following command(the TARGET-FILE points to the location of the project file that has the extension .mpr):
    mx dump-mpr [OPTIONS] [TARGET-FILE] > model_dump.json 
  4. A model_dump.json file is created, containing the app model. 

For more information, see the Mendix documentation: mx command-line tool

Option 2: Leveraging the Mendix SDK

The Mendix Software Development Kit (SDK) provides a powerful way to programmatically interact with the Mendix app model. Every model element (pages, microflows, entities, etc.) and its properties are open and accessible via the Mendix SDK. This allows for exporting the Mendix app model and then processing it to generate new representations.

Instructions:

  1. Set up the development environment for the Mendix SDK.
  2. Write a script that connects to the Mendix app model via the SDK.
  3. Iterate through the entities in the domain model.
  4. For each entity, extract its name, module, attributes (name, data type, length), associations (name, type, related entities), and any documentation/annotations.
  5. Use a library to write this extracted information into an Excel spreadsheet.

For detailed SDK use cases, see the Mendix documentation: SDK Use Cases

Option 3: Utilizing the Model Reflection Module and Export to Excel

The Model Reflection module, available in the Mendix Marketplace, makes some of the domain model information accessible via the Mendix user interface. Use entities within this module to create a data grid with the necessary information and then add an "Export to Excel" button to that data grid.

Instructions:

  1. Download and import the Model Reflection module from the Mendix Marketplace into the project.
  2. In Studio Pro, create a new page and add a data grid to this page.
  3. Configure the data grid to display information from the Model Reflection entities that expose domain model details (e.g., entities related to Entity, Attribute, Association).
  4. Add an "Export to Excel" button to the data grid. This typically involves using a Marketplace module for Excel export or implementing custom logic to generate the Excel file from the data grid's content.

For a community discussion on this approach, check the Mendix forum post: Exporting Domain Model to Excel

Outcome

The Mendix app model is exported to a JSON or Excel file.

Internal information related

  • 275400, 277989

Additional information

Not applicable

Have more questions? Submit a request

0 Comments

Article is closed for comments.

To provide feedback, please open a ticket here. Don't forget to include the article's URL along with the feedback you would like to provide.