github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/gen/parser/create_object_doc.yaml (about)

     1  - DocumentID: create-object
     2    Title: >-
     3      `%{}` Create Map
     4    CategoryID: parser
     5    Summary: >-
     6      Quickly generate objects and maps
     7    Description: |-
     8      `%{}` is a way of defining objects in expressions and statements. Whenever an
     9      `%{}` object is outputted as a string, it will be converted to minified JSON.
    10  
    11      Object elements inside `%{}` can be new line and/or comma delimited. This
    12      allows for compatibility with JSON but without the pain of accidentally invalid
    13      comma management breaking JSON parsers. However a colon is still required to
    14      separate keys from values.
    15  
    16      Like with YAML, strings in `%[]` do not need to be quoted unless you need to
    17      force numeric or boolean looking values to be stored as strings.
    18    Examples: |-
    19      **Object passed as a JSON string:**
    20  
    21      ```
    22      » echo %{foo: bar}
    23      {"foo":"bar"}
    24      ```
    25  
    26      **The `%` prefix for the nested object is optional:**
    27  
    28      ```
    29      » %{foo: bar, baz: [1 2 3]}
    30      {
    31          "baz": [
    32              1,
    33              2,
    34              3
    35          ],
    36          "foo": "bar"
    37      }
    38      ```
    39    Detail:
    40    Related:
    41    - create-array
    42    - single-quote
    43    - double-quote
    44    - brace-quote
    45    - expr
    46    - mkarray/special
    47