Exporting and importing objects as JSON files
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
Both entity and entity collection objects support overloadings
of the Export( ) and Import( ) methods
using a format to store and retrieve object data similar to the
ABL WRITE-JSON( ) and READ-JSON( ) methods
(respectively) on a temp-table. In addition, these objects support ExportTree( ) and ImportTree( ) methods
that export and import an entire object, including all child collections.
The ExportTree( ) method is overloaded
with a parameter to specify what collections to export. The ExportTree( ) and ImportTree( ) methods
use a format to store and retrieve object data similar to the ABL WRITE-JSON( ) and READ-JSON( ) methods
(respectively) on a ProDataSet.
The following code exports all tenants in the database into a JSON (.json) file:
|
The following code loads new tenants from a JSON file and into the database:
|
This import can also be done on existing tenants as shown using
the ImportTree( ) method in a following
example.
The following code exports all tenants and partitions in the database into a JSON file:
|
The following code imports tenants and any child objects from the specified JSON file into the database:
|
This import can also be done for new tenants as shown using the Import( ) method
in a previous example.