---
title: "Metadata setting structure"
slug: "metadata-setting-structure"
abstract: "Map file metadata to asset properties with ImportMetadataConfiguration for automated enrichment, related mappings, conversions, and C2PA AI detection."
---
# Metadata setting structure

The following code snippet shows an example of the `ImportMetadataConfiguration` setting. This JSON configuration maps metadata extracted from uploaded files (such as file size, file name, and image width from various sources) to specific asset properties and relations in Sitecore Content Hub. It defines how metadata should be transferred into the `MainFile` property and the `MasterFile` relation, including optional conversions like file size formatting.

```json
{
 "from": {
  "extension": "extension",
  "filesize": {
   "file": "metadata",
   "path": ["$['File:FileSize']"]
  },
  "filename": {
   "file": "metadata",
   "path": ["$['File:FileName']"]
  },
  "width": {
   "file": "metadata",
   "path": [
    "$['Composite:ImageWidth']",
    "$['File:ImageWidth']",
    "$['EXIF:ImageWidth']",
    "$['QuickTime:ImageWidth']",
    "$['MPEG:ImageWidth']",
    "$['PNG:ImageWidth']",
    "$['GIF:ImageWidth']",
    "$['Photoshop:ImageWidth']",
    "$['RIFF:ImageWidth']",
    "$['ASF:ImageWidth']"
   ]
  }
 },
 "to": {
  "properties": {
   "MainFile": {
    "bag": "properties",
    "properties": {
     "extension": "extension",
     "filesize": {
      "value": "filesize",
      "conversion": "FileSize"
     },
     "filesizebytes": "filesize",
     "filename": "filename",
     "width": "width"
    }
   }
  },
  "related": [
   {
    "relation": "MasterFile",
    "role": "Child",
    "properties": {
     "FileSize": {
      "value": "filesize",
      "conversion": "FileSize"
     },
     "FileProperties": {
      "bag": "properties",
      "properties": {
       "extension": "extension",
       "width": "width"
      }
     }
    }
   }
  ]
 }
}

```

The `ImportMetadataConfiguration` JSON configuration contains two sections:

- `from` - metadata to extract from the uploaded file.
- `to` - set properties where the metadata is to be mapped.

## The from section

The `from` section of the example contains three types of metadata property declarations. The following table explains them:

- `from` clause: Description
- {
  "extension": "extension"
}: `Extension` *(first occurrence)* - reference used in the `to` section.`Extension` *(second occurrence)* - the property name in the system.NoteLack of `file` or `path` parameters indicates that this is referencing a static metadata property.
- {
  "filesize": {
    "file": "metadata",
    "path": [
      "$['File:FileSize']"
    ]
  }
}: `filesize`: reference used in the `to` section.`file`: file where the property is located. In this case, `metadata` refers to the *metadata.json* file.`path`: path of the property in the metadata file.NoteThe `path` values reference the `metadata` property in the *metadata.json* file.
- {
  "width": {
    "file": "metadata",
    "path": [
      "$['Composite:ImageWidth']",
      "$['File:ImageWidth']",
      "$['EXIF:ImageWidth']",
      "$['QuickTime:ImageWidth']",
      "$['MPEG:ImageWidth']",
      "$['PNG:ImageWidth']",
      "$['GIF:ImageWidth']",
      "$['Photoshop:ImageWidth']",
      "$['RIFF:ImageWidth']",
      "$['ASF:ImageWidth']"
     ]
  }
}: `width` - reference used in the `to` section.`file` - file where the property is located. In this case, `metadata` refers to the *metadata.json* file.`path` - path of the property in the metadata file.NoteWhen the `path` parameter has multiple values, the processor parses all entries in order until it finds a valid value.

## The to section

The `to` section maps metadata properties defined in the `from` section to the asset properties.

When you upload a file, it is associated with an asset entity using the *MasterFile* relation. The `to` section in the metadata configuration starts with the file entity properties and continues with the asset entity properties using the `related` attribute.

The following diagram illustrates the structure of the `to` section:

![Structure of the to section in the setting configuration](https://doc.sitecore.com/api/markdown-image/ch/en/users/content-hub/images/structure_of_the_to_section_in_the_setting_configuration.png)

The `to` section contains two parts, `properties` and `related`.

### Properties mapping

`properties` is a list of mappings between the `from` section and the file entity properties. A mapping can be *complex*, containing sub-properties organized in bags; or *simple*, containing simple single-valued properties.

A *complex mapping* is a property that references a member of the entity definition, such as `MainFile`. It includes the following properties:

- `bag` - name of the bag in which the properties are stored, such as `properties`.
- `properties` - list of simple properties to be stored in the bag.

A *simple mapping* is a property that references a member of the entity definition, such as `filesize`. It includes the following properties:

- `value` - value assigned to the property. For example, `filesize` that references a property of the `from` section.
- `conversion` - conversion to apply on the value. For example, `FileSize`.

Both `value` and `conversion` are optional, so you can provide a simple key-value mapping instead, such as `width:width`.

### Related mapping

`related` is an array of mappings between the `from` section and the properties of related entities such as `Asset`.

A related mapping is a property that describes the relation to a related entity, such as `MasterFile`. It includes the following properties:

- `role` - role of the file entity in the relation. For example, in the `MasterFile` relation, *File* is a child of *Asset*. Valid values are `parent` or `child`.
- `properties` - an array of complex or simple property mappings to the related entity.

### Conversion logic

Metadata configuration supports the following values for the `conversion` property:

- `Duration` - Rounds the duration value with a factor of 1000.
- `FileSize` - Rounds the file size using two decimal places and a factor of 0.000001.
- `ArrayToString` - Concatenates the elements of the array to create a single, comma-separated string.