i am asking here as Reddit r/shortcuts is now read only (so glad its back as i had loads saved that i refered back to) so hoping some of the people that were on there have joined the Automators Forum
my original post was to add items to a Dictionary, as in this post on Reddit and the reply that works is also below
Post: Adding to a dictionary, but do i use a nested array or a nested dictionary?
By: macro-maker
Link: https://www.reddit.com/r/shortcuts/comments/1415y3d/adding_to_a_dictionary_but_do_i_use_a_nested/
I can remove the whole dictionary Key / value ,Object pair using this shortcut
https://www.icloud.com/shortcuts/bf94cf714d8c4209a2437596761133dd
doing some research it apears that this dictionary structure is a JSON dictionary Object.
so can anyone help with removing one object but keep all other objects associated with that Key?
Reply from u/vrachamis
Take your time! If you’re having difficulties putting this together the following shortcut is for adding fault entries to your vehicles with the mentioned structure.
https://www.icloud.com/shortcuts/ca7f4e322d5a44289623533c3ca3321e
This one is for reading fault entries per vehicle.
https://www.icloud.com/shortcuts/bc15ceffe1b14670a44dce1d0deea5c4
I’m a bit confused. You’re asking about nested item removal but then shared shortcuts for dealing with a vehicle?
yes thats correct. the dictionary is for keeping records of faults on vehicles, that are nested under the vehicle reg no and the faults are then i believe a json object of fault with the date and time.
i am currently have difficulty in re opening the shortcuts i posted, i am guessing from your reply you can open them ok? so would point that my problem opening them is just for me
i am in contact with apple about shortcuts trying to resolve, but thats a different issue.
The server issue you are experiencing is impacting everyone.
As for what to do about your issue. Can you share an example of the dictionary / JSON and what you’d like to be able to remove?
heres an example of the Json
these are dummy records but in the correct format
{
“AB12 CDE”: {
“Engine Management Light”: “9 Jul 2023 at 06:56:22”,
“R/Os Tyre-close to limit”: “9 Jul 2023 at 06:56:11”,
“Passenger,Wiper Needs Replacing”: “9 Jul 2023 at 13:09:14”
},
“CD34 EFG”: {
“Engine Management Light”: “9 Jul 2023 at 06:56:22”,
“Passenger,Wiper Needs Replacing”: “9 Jul 2023 at 13:09:14”,
“F/Ns Tyre-at limit”: “9 Jul 2023 at 06:56:11”
},
“EF56 HJK”: {
“Rollershutter Door,Tensioner not working”: “29 May 2023 at 08:22:23”
}
}
for example i want to remove the fault with AB12 CDE for the “F/Ns Tyre-at limit”: “9 Jul 2023 at 06:56:11”
i was hope to be able to chose the Vehicle then chose the fault from the dictionary
what i have been doing is creating a disctionary from the JSON , copy the dictionary as a dictionary into another shortcut , edit the parts i no longer need and then re writing the file over the original JSON file to update with the entry removed, its long winded but works for my knowledge, i cant just quite get the syntax / steps to remove a JSON object that is efectively the value in a Key/ Value Pair.
If you’re not too particular on where you’re saving your data, take a look at Data Jar. It has Shorcuts actions to help with your case.
Another option, if you know Javascript and want a bit more control, Scriptable from the same developer is a great companion app for Shortcuts.
1 Like
thanks @supermamon
i have heard of both these options i was hope that i could keep it as a JSON file stored on icloud , i have minisclue knowledge on javascript , but it apears that i should with some help be able to use the built in parts of shortcuts and dictionaries maybe to acheive what i want , or just stick with my longwinded way

Your best bet would be Data Jar. You can use it to temporary store your dictionary, remove the key you don’t need then retrieve it back.
2 Likes