Giter Club home page Giter Club logo

Comments (4)

Drakesinger avatar Drakesinger commented on June 8, 2024

Yes it's possible.
Here is a working example on how I did this locally.

Source :

{
  "MailConfigurations": {
    "Configurations": [
      {
        "ConfigurationName": "DoStuff",
        "FromAddress": "[email protected]",
        "DeliveryMethod": "SpecifiedPickupDirectory",
        "SpecifiedPickupDirectory": "\\\\server\\Mails\\ServerName"
      },
      {
        "ConfigurationName": "ApplicationUserLogin",
        "FromAddress": "[email protected]",
        "TemplateDirectory": ".\\Templates\\Login",
        "TemplateFile": "file{0}.html",
        "DeliveryMethod": "SpecifiedPickupDirectory",
        "SpecifiedPickupDirectory": "\\\\secondserver\\appdata\\Stuff\\BlaBla"
      }
    ]
  }
}

The transform:

{
    "MailConfigurations": {
        "@jdt.replace": [
            {
                "@jdt.path": "Configurations[0].FromAddress",
                "@jdt.value": "[email protected]"
            },
            {
                "@jdt.path": "Configurations[1].SpecifiedPickupDirectory",
                "@jdt.value": "J:\\special\\profile\\change"
            }
        ]
    }
}

Output :

{
  "MailConfigurations": {
    "Configurations": [
      {
        "ConfigurationName": "DoStuff",
        "FromAddress": "[email protected]",
        "DeliveryMethod": "SpecifiedPickupDirectory",
        "SpecifiedPickupDirectory": "\\\\server\\Mails\\ServerName"
      },
      {
        "ConfigurationName": "ApplicationUserLogin",
        "FromAddress": "[email protected]",
        "TemplateDirectory": ".\\Templates\\Login",
        "TemplateFile": "file{0}.html",
        "DeliveryMethod": "SpecifiedPickupDirectory",
        "SpecifiedPickupDirectory": "J:\\special\\profile\\change"
      }
    ]
  }
}

if you are looking for a way to modify all attributes, like for example DeliveryMethod, I have not found a way to do this yet,
Configurations[*].DeliveryMethod as path does not work.

from slow-cheetah.

mwpowellhtx avatar mwpowellhtx commented on June 8, 2024

Interesting, so would something like this work,
Not sure I have a use case where I need to replace all attributes across a range of an array, but that is an interesting postulate.

How about if I want to replace just one specific element, then I do this?

{
    "MailConfigurations": {
        "@jdt.replace": [
            {
                "@jdt.path": "Configurations[0]",
                "@jdt.value": {...}
            }
        ]
    }
}

from slow-cheetah.

Drakesinger avatar Drakesinger commented on June 8, 2024

Yep.

from slow-cheetah.

mwpowellhtx avatar mwpowellhtx commented on June 8, 2024

Brilliant, thank you for the feedback.

from slow-cheetah.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.