Skip to content

Default Transformation

Davi Paulino edited this page May 4, 2017 · 2 revisions

If no behavior is specified in any JSON object, the default transformation is to merge the two files. The goal of JDT is to have a default behavior that satisfies most user scenarios. For more specifics on merging, see the Merge transformation.

Example

Source:

{
    "Version": 1,
    "Settings": {
        "Setting01" : "Default01",
        "Setting02" : "Default02"
    },
    "SupportedVersions" : [1, 2, 3]
}

Transform:

{
    "Version": 2,
    "Settings": {
        "Setting01" : "NewValue01",
        "Setting03" : "NewValue03"
    },
    "SupportedVersions" : [4, 5],
    "UseThis" : true
}

Result:

{
    // Overriden by the transformation file
    "Version": 2,
    "Settings": {
        // Overriden by the transformation file
        "Setting01" : "NewValue01",
        // Not present in the transformation file, unchanged
        "Setting02" : "Default02",
        // Added by the transformation file
        "Setting03" : "NewValue03"
    },
    // The array in the transformation file was appended
    "SupportedVersions" : [1, 2, 3, 4, 5],
    // Added by the transformation file
    "UseThis" : true
}