Background: I am trying to use JSON within KM to more succinctly and easily define a bunch of variables and/or dictionary keys:values. Using "Set Dictionary to JSON" seemed like the easiest way to accomplish this.
Situation: I am able to copy the example code from the wiki and it successfully executes the step. If I try to add another key:value pair, it stops working. If I modify the example with different key:values, that still works. As soon as I delete a quote mark and re-type it, the step fails.
Assessment: It appears that KM is not parsing quotes equally (straight vs opening vs closing quotes).
Thanks in advance for the guidance.
Howdy, welcome to the forum! As you might have already figured out, this is a great community full of people who love to help.
I don't really work with json, but since you mentioned the quotation marks I may have an idea. This really doesn’t sound like an issue with Keyboard Maestro per se, but rather using the wrong quotation marks. With any scripting you can't use "smart quotes", which macOS usually has turned on by default. Check your settings in the following screen shot:
You can either turn that off, or simply make sure when you're working with scripts to not let the OS auto-correct your quotation marks to smart quotes.
Keyboard Maestro doesn’t parse quotes equally because it’s not supposed to. Straight double quotes are used to delimit strings in JSON. Follow @cdthomer’s advice to ensure you don’t end up with curly quotes by mistake.
Thank you, you both are brilliant. That was the issue. Surprised it hasn't shown up more on these forums (I did try searching!).
This can be considered solved and closed
You can check the "Solution" box on one or more of the replies to indicate it's solved.