%{}
Object BuilderQuickly generate objects (dictionaries / maps)
%{}
is a way of defining objects in expressions and
statements. Whenever an %{}
object is outputted as a
string, it will be converted to minified JSON.
Object elements inside %{}
can be new line and/or comma
delimited. This allows for compatibility with JSON but without the pain
of accidentally invalid comma management breaking JSON parsers. However
a colon is still required to separate keys from values.
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 %{foo: bar}
{"foo":"bar"}
The %
prefix for the nested object is optional:
» %{foo: bar, baz: [1 2 3]}
{
"baz": [
1,
2,
3
],
"foo": "bar"
}
The syntax is pretty flexible, albeit all Murex objects are displayed as JSON objects when printed to screen or otherwise handled like a string.
Each key needs to be followed by a colon,
:
.
Each value needs to be followed by either a comma,
,
, new line or closing curly brace, }
.
Strings can be quoted or unquoted (like with statement parameters).
However any unquoted values will first be tested to see if it is a
number, boolean (true
of false
) or null
(null
). Keys are always strings (str
), even if
they look like a number.
expr
):
Expressions: mathematical, string comparisons, logical operators"Double Quote"
:
Initiates or terminates a string (variables expanded)%(Brace Quote)
:
Initiates or terminates a string (variables expanded)%[]
Array
Builder: Quickly generate arrays'Single Quote'
:
Initiates or terminates a string (variables not expanded)This document was generated from gen/parser/create_object_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 Wed Jan 15 23:07:50 UTC 2025 against commit b4c4296b4c429617fd41527ea0efef33c52c15ef2b64972.
Current version is 6.4.2063 (develop) which has been verified against tests cases.