Write Dictionary JSON to File

I can save a dictionary JSON to a file like this:

How can I use a variable for the name of the dictionary in place of "Sample_dict" above? When I try:

I get a file with: {}VariableSample_dict% instead of the JSON.

I thought it might be something like double percentages with dynamic variables or needing to process the token, but I'm not getting it.

For the record, it was both. After some trial and error, this did the trick:

2 Likes

Can anyone maybe jump in and explain why this should be done like Evan figured out in post #2 ??!

I want to export my dictionaries into files and i stumped also on the same mistake he made but could not figure out how to do it …

Now I that I know - I just don’t understand…

Am I missing something that maybe is documented in the wiki ?!

Greetings from Germany

Tobias

That's exactly what I was working on. Here's my macro that saves all dictionaries to a folder on the desktop. You can change the path in the first action to an existing folder of your choice.

Save Dicitonaries.kmmacros (3.2 KB)

Macro Image

There's a great explanation of text processing here, but I couldn't find an explanation for the JSON part of it, hence the trial and error.

1 Like

Thanks Evan …

Also for the Macro … I’ve read through the Explanation on that wiki page you’ve linked to …

I think it has to be done like in your solution just because of the fact that there has to be some dynamic changeable part in the whole thing which is done with something like a placeholder Variable - like you did it …

I am not really sure if my thoughts are right … that’s one of many situations I wish to have Jim back.

Greetings from Germany

Tobias