If JSON dictionary contains a given key

In a Keyboard Maestro IF action, you can branch on whether a given key is found in a JSON dictionary (also known as a JSON key-value Object).

Note that in the chevron menu to the left of the JavaScript script test, we specify:

  1. Modern Syntax (to provide the kmvar.KMVariableName notation), and
  2. which KM variable names we want to be able to reference in this way (checking items in list)


If JSON dictionary contains a given key ....kmmacros (9.2 KB)

2 Likes

Very cool stuff! Was the deltad intentional to show the failure state? Took me a minute to figure out why the macro wasn't returning any pretty JSON to look at :).

-rob.

1 Like

Perhaps that does introduce redundant effort :slight_smile:

(I’ll amend it when I’m near a macOS system)


UPDATE

Done (above).