Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easier way to replace an array? #60

Open
ImGonaRot opened this issue Mar 14, 2024 · 0 comments
Open

Easier way to replace an array? #60

ImGonaRot opened this issue Mar 14, 2024 · 0 comments

Comments

@ImGonaRot
Copy link

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]
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant