Generic JSON Export Reference Metadata Example

Using the Export Manager, this example demonstrates how to create a JSON template and the required mapping to output a JSON document that includes the reference metadata.

In this example, a bike object has two Accessory references. The 'Purpose' attribute is metadata on the reference type that holds text for a website advertisement.

Template

Open the Export Manager and select the object(s) for export. On the Select Format step, select the 'Generic JSON' format, copy the following text, and paste it into the Template parameter. Click Next.

Copy
{
  "products": [
    {
      "__type": "__record",
      "id": "__target ID",
      "name": "__target Name",
     "parentId": "__target Parent",
      "accessoryRefs": [
        {
          "targetId": "__target AccessoryID",
          "targetName": "__target AccessoryName",
          "targetPurpose": "__target Purpose"
        }
      ]
    }
  ]
}

Mapping

On the Map Data step, map the ID, Name, and Parent ID for the specified target elements.

Select the 'Multi level References' data source and map to the 'accessoryRefs' target. For the Multi Level Data Source dialog:

  • On the 'Select reference' step, choose 'Accessory' reference type.

  • On the 'Select Path' step, leave the default values.

  • On the 'Select source' step, select the 'Reference meta-data attributes' radio button.

  • On the 'Select attribute' step, select the 'Purpose' attribute.

  • Click 'Finish'.

For details on configuring multi level references, refer to the Multi Level References - Data Source Outbound topic.

Modify the automatic selections as follows:

  • Click the 'X' button to delete the AccessoryID and AccessoryName mappings. 'Nothing mapped' is displayed.

  • If desired, to export only the value (instead of 'Value and unit'), click the transformation button and select the 'Value' aspect for the Purpose target. For details on transformations, refer to the Outbound Map Data - Transform topic.

Expand the 'Product References' data source, select the 'Accessory' reference type, and map to the 'AccessoryID' target.

Select the 'Multi level References' data source to map and transform the AccessoryName target. For the Multi Level Data Source dialog:

  • On the 'Select reference' step, choose 'Accessory' reference type.

  • On the 'Select Path' step, leave the default values.

  • On the 'Select source' step, select the 'Referenced node' radio button.

  • The 'Select attribute' step is not applicable in this scenario.

  • Click 'Finish'.

For details on configuring multi level references, refer to the Multi Level References - Data Source Outbound topic.

If desired, click the transformation button to export the default Accessory Name aspect instead of the ID. For details on transformations, refer to the Outbound Map Data - Transform topic.

Finish the Export Manager wizard steps and start the export process to generate the following JSON output.