Skip to content

Easier way to replace an array? #60

@ImGonaRot

Description

@ImGonaRot

Under the "Default Transformation" section there is an array listed as "SupportedVersions" that says the default transformation for arrays is append but when going to the "Replace" section, it does not show how to replace an array.

Let's assume I have 2 appsettings.json files that need merged so that the SupportedVersions array is replaced when listed under the Settings section.

First file

{
    "Settings": {
        "SupportedVersions" : [1, 2]
    }
}

Second file

{
    "Settings": {
        "SupportedVersions" : [3, 4]
    }
}

Expected output

{
    "Settings": {
        "SupportedVersions" : [3, 4]
    }
}

I can get this to work by using the following but is there an easier way that I can't find in the documentation?
This works but is long

{
    "Settings": {
        "@jdt.replace" : {
            "@jdt.path" : "$.SupportedVersions",
            "@jdt.value" : [3, 4]
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions