This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
function:JSONVALUE [2019/06/24 05:03] peternlewis created |
function:JSONVALUE [2023/09/20 00:19] (current) peternlewis |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== JSONValue ====== | + | ====== JSONVALUE Function ====== |
- | The //JSONVALUE// function takes a [[:manual:JSON#JSON_Paths|JSON path]] and returns the numeric result. | + | The //JSONVALUE(t)// function takes a [[:manual:JSON#JSON_Paths|JSON path]] and returns the numeric result. |
`JSONVALUE(jsonpath)` is more or less equivalent to `CALCULATE(%JSONValue%jsonpath%)`. | `JSONVALUE(jsonpath)` is more or less equivalent to `CALCULATE(%JSONValue%jsonpath%)`. | ||
- | ===== Example ===== | + | ===== Examples ===== |
If a Keyboard Maestro variable `J` contains the JSON object: | If a Keyboard Maestro variable `J` contains the JSON object: | ||
- | {"a":9, "b":"bravo", "c":null, "d":[1,"two",3]} | + | {"a":9, "b":"bravo", "c":null, "d":[11,"two",33]} |
Then these would be the results: | Then these would be the results: | ||
- | ^ Token ^ Result ^ | + | ^ Token ^ Result ^ Comment ^ |
- | | `JSONVALUE(J.a)` | `9` | | + | | `JSONVALUE(J.a)` | `9` | | |
- | | `JSONVALUE(J.d[1])` | `11` | | + | | `JSONVALUE(J.d[1])` | `11` | | |
- | | `JSONVALUE(J.d[3])` | `33` | | + | | `JSONVALUE(J.d[3])` | `33` | | |
- | | `JSONVALUE(J.d[1+2])` | `33` | | + | | `JSONVALUE(J.d[1+2])` | `33` | entry 3 | |
- | | `JSONVALUE(J.d[0])` | `3` | | + | | `JSONVALUE(J.d[0])` | `3` | the number of entries in the array | |
+ | | `JSONVALUE(J.d[-1])` | `33` | the last entry | | ||
+ | | `JSONVALUE(J.d[COUNT()])` | `33` | the last entry | | ||
===== See Also ===== | ===== See Also ===== | ||
Line 33: | Line 35: | ||
=== Functions === | === Functions === | ||
- | * [[function:JSONVALUE | JSONVALUE(jsonpath)]] | ||
* [[:Functions|See all Functions]] | * [[:Functions|See all Functions]] | ||
Line 42: | Line 43: | ||
* [[token:JSONValue | JSONValue]] | * [[token:JSONValue | JSONValue]] | ||
* [[:Tokens|See all Tokens]] | * [[:Tokens|See all Tokens]] | ||
+ | |||
+ | === Collections === | ||
+ | |||
+ | * [[collection:JSON_Keys | JSON Keys]] | ||
+ | * [[:Collections |See all Tokens]] | ||