%[]
Array BuilderQuickly generate arrays
%[]
is a way of defining arrays in expressions and statements. Whenever a %[]
array is outputted as a string, it will be converted to minified JSON.
Array elements inside %[]
can be whitespace and/or comma delimited. This allows for compatibility with both Bash muscle memory, and people more familiar with JSON.
Additionally you can also embed a
style parameters inside %[]
arrays too.
Like with YAML, strings in %[]
do not need to be quoted unless you need to force numeric or boolean looking values to be stored as strings.
» echo %[1..3]
[1,2,3]
» %[1..3] -> cat
[1,2,3]
» %[1..3]
[
1,
2,
3
]
» %[1,2,3]
[
1,
2,
3
]
» %[1 2 3]
[
1,
2,
3
]
» %[1,2..3]
[
1,
2,
3
]
This will allow you to copy/paste lists from traditional shells like Bash
» %[foo bar]
[
"foo",
"bar"
]
» %["foo", "bar"]
[
"foo",
"bar"
]
» %[June..August]
[
"June",
"July",
"August"
]
A full list of special ranges are available at docs/mkarray/special
» %[[A,B]:[1..4]]
[
"A:1",
"A:2",
"A:3",
"A:4",
"B:1",
"B:2",
"B:3",
"B:4"
]
» %[foo [bar]]
[
"foo",
[
"bar"
]
]
The %
prefix for the nested array is optional.
» %[foo {bar: baz}]
[
"foo",
{
"bar": "baz"
}
]
The %
prefix for the nested object is optional.
Murex supports a number of different formats that can be used to generate arrays. For more details on these please refer to the documents for each format
"Double Quote"
: Initiates or terminates a string (variables expanded)%(Brace Quote)
: Initiates or terminates a string (variables expanded)%{}
Object Builder: Quickly generate objects (dictionaries / maps)'Single Quote'
: Initiates or terminates a string (variables not expanded)a
(mkarray): A sophisticated yet simple way to build an array or listexpr
: Expressions: mathematical, string comparisons, logical operatorsja
(mkarray): A sophisticated yet simply way to build a JSON arrayta
(mkarray): A sophisticated yet simple way to build an array of a user defined data-typeThis document was generated from gen/parser/create_array_doc.yaml.
This site's content is rebuilt automatically from murex's source code after each merge to the master
branch. Downloadable murex binaries are also built with the website.
Last built on Thu Aug 15 14:38:34 UTC 2024 against commit 50ed9d650ed9d6df391240d3c2c02e623636e508dfcdad1.
Current version is 6.2.4000 which has been verified against tests cases.