This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
manual:JSON [2019/06/24 00:49] peternlewis |
manual:JSON [2019/06/24 05:01] peternlewis [Pretty, Compact and Strict Flags] |
||
---|---|---|---|
Line 52: | Line 52: | ||
{"a":3,"b":null} | {"a":3,"b":null} | ||
- | whereas the result of %JSONValuePretty%J%` will be: | + | whereas the result of `%JSONValuePretty%J%` will be: |
{ | { | ||
Line 59: | Line 59: | ||
} | } | ||
- | The exact indentation should not be assumed, it might be any number fo spaces or tabs. | + | The exact indentation should not be assumed, it might be any number of spaces or tabs. |
The Strict flag relates only to JSON results that are trivial JSON strings, eg JSON `"result"`. | The Strict flag relates only to JSON results that are trivial JSON strings, eg JSON `"result"`. | ||
Line 79: | Line 79: | ||
The default result format is Compact, Non-Strict. | The default result format is Compact, Non-Strict. | ||
- | ===== Actions ===== | + | ===== Use ===== |
+ | There are [[:Actions|actions]] to set dictionaries or variables from JSON containers, as well as an [[:action: Set_JSON_Value|action]] to set a field within a JSON object to a specified value. | ||
===== Notes ===== | ===== Notes ===== | ||
Line 87: | Line 87: | ||
JSON objects must be properly legal to be processed. In particular keys to objects must be strings, which means strings must be quoted with double quotes. `{ a : 3 }` is not valid, it must be `{ "a" : 3 }`. | JSON objects must be properly legal to be processed. In particular keys to objects must be strings, which means strings must be quoted with double quotes. `{ a : 3 }` is not valid, it must be `{ "a" : 3 }`. | ||
- | Although `3` and `"a"` are technically legal JSON, in cases of ambiguity, Keyboard Maestro will not consider a variable to contain JSON unless it is a container, ie an array or dictionary, which starts (without any leading white space) with a `{` or `[`, and ends with a matching bracket followed by optional white space. | + | Although `3` and `"a"` are technically legal JSON, in Non-Strict mode with cases of ambiguity, Keyboard Maestro will not consider a value or variable to contain JSON unless it is a container, ie an array or dictionary, which starts (without any leading white space) with a `{` or `[`, and ends with a matching bracket followed by optional white space. |