Okay, let’s do a worked example. Here’s the result of grabbing a slightly simplified version of your dictionary that I set up in Data Jar.
Here you can hopefully see that
matters contains two projects - “Project 1” and “Project 2”. Each with a couple of items of data that are different in each project.
Now let’s say I wanted to rename “Project 1” to “Case A”. We can think of changing the value of the key. Now, as shown in the output above, the JSON that represents the dictionary can be expressed in a plain text format. Therefore we could modify that and write it back to the
matters entry in Data Jar.
A bit of regular expression substiution should suffice...
You would add this to a Replace Text action and set it as a regular expression.
But, we can make this a bit easier by looking at this from the other computing perspective. Rather than rename it, we can produce the equivalent by duplicating it to a new name and removing the one with the original name. If we look at it that way, it is actually easy to do, and hopefully understand, with the actions that Data Jar provides.
Ref: Download this Matters Example Shortcut.
Step 1 - get the value stored in the dictionary
Project 1 which is nested in dictionary
matters, in Data Jar.
Step 2 - create a new nested dictionary in
matters in Data Jar called
Case A, which has the content retrieved in the previous step.
Step 3 - delete the
Project 1 dictionary nested in
matters in Data Jar.
Now if I run the original check again, “Project 1” has gone, but “Case A” exists and has the same content that “Project 1” originally had - in effect, a rename.
Hopefully, that sets you on the right track.