diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2018-09-30 01:08:51 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2018-09-30 01:08:51 +0100 |
commit | 8fdf20fd84ec88d8f8a250f56d2b4d29ba946392 (patch) | |
tree | 4dd39d4b84fff56315dd06fa230c8787d9a0dda3 /doc | |
parent | c092711614b9b12df56869a95bc9609f913e7be3 (diff) |
Expansions: extract methods for JSON objects and arrays. Bug 2282
Diffstat (limited to 'doc')
-rw-r--r-- | doc/doc-docbook/spec.xfpt | 34 | ||||
-rw-r--r-- | doc/doc-txt/NewStuff | 2 |
2 files changed, 36 insertions, 0 deletions
diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index 8fde6397c..1dfa55228 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -9374,6 +9374,27 @@ ${extract{Z}{A=... B=...}{$value} fail } This forces an expansion failure (see section &<<SECTforexpfai>>&); {<&'string2'&>} must be present for &"fail"& to be recognized. +.new +.vitem "&*${extract json{*&<&'key'&>&*}{*&<&'string1'&>&*}{*&<&'string2'&>&*}&&& + {*&<&'string3'&>&*}}*&" +.cindex "expansion" "extracting from JSON object" +.cindex JSON expansions +The key and <&'string1'&> are first expanded separately. Leading and trailing +white space is removed from the key (but not from any of the strings). The key +must not be empty and must not consist entirely of digits. +The expanded <&'string1'&> must be of the form: +.display +{ <&'"key1"'&> : <&'value1'&> , <&'"key2"'&> , <&'value2'&> ... } +.endd +.vindex "&$value$&" +The braces, commas and colons, and the quoting of the member name are required; +the spaces are optional. +Matching of the key against the member names is done case-sensitively. +. XXX should be a UTF-8 compare + +The results of matching are handled as above. +.wen + .vitem "&*${extract{*&<&'number'&>&*}{*&<&'separators'&>&*}&&& {*&<&'string1'&>&*}{*&<&'string2'&>&*}{*&<&'string3'&>&*}}*&" @@ -9406,6 +9427,19 @@ yields &"99"&. Two successive separators mean that the field between them is empty (for example, the fifth field above). +.new +.vitem "&*${extract json{*&<&'number'&>&*}}&&& + {*&<&'string1'&>&*}{*&<&'string2'&>&*}{*&<&'string3'&>&*}}*&" +.cindex "expansion" "extracting from JSON array" +.cindex JSON expansions +The <&'number'&> argument must consist entirely of decimal digits, +apart from leading and trailing white space, which is ignored. + +Field selection and result handling is as above; +there is no choice of field separator. +.wen + + .vitem &*${filter{*&<&'string'&>&*}{*&<&'condition'&>&*}}*& .cindex "list" "selecting by condition" .cindex "expansion" "selecting from list by condition" diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index 8d2bf22e3..3f257206b 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -25,6 +25,8 @@ Version 4.92 6. Builtin macros for supported log_selector and openssl_options values. + 7. JSON variants of the ${extract } expansion item. + Version 4.91 -------------- |