github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/types/mxjson.md (about)

     1  # mxjson
     2  
     3  > Murex-flavoured JSON (deprecated)
     4  
     5  ## Description
     6  
     7  > This format has been deprecated in favour of `%{}` constructors.
     8  
     9  mxjson is an extension to JSON designed to integrate more seamlessly when
    10  use as a configuration file. Thus mxjson supports comments and Murex code
    11  blocks embedded into the JSON schema.
    12  
    13  > mxjson is a format that is pre-parsed into a valid JSON format.
    14  
    15  mxjson isn't a Murex data-type in that you cannot marshal
    16  and unmarshal mxjson files. Currently it is a format that is only supported
    17  by a small subset of Murex builtins (eg `config` and `autocomplete`) where
    18  config might embed Murex code blocks.
    19  
    20  **mxjson features the following enhancements:**
    21  
    22  ### Line Comments
    23  
    24  Line comments are prefixed with a 'hash', `#`, just like with regular Murex
    25  code.
    26  
    27  ### Block Quotation
    28  
    29  Code blocks are quoted with `(`, `)`. For example, below "ExampleFunction"
    30  uses the `({ block quote })` method.
    31  
    32  ```
    33  {
    34      "ExampleFunction": ({
    35          out "This is an example Murex function"
    36          if { =1==2 } then {
    37              err "The laws of the universe are broken"
    38          }
    39      })
    40  }
    41  ```
    42  
    43  Any block quoted by this method will be converted to the following valid JSON:
    44  
    45  ```
    46  {
    47      "ExampleFunction": "\n    out \"This is an example Murex function\"\n    if { =1==2 } then {\n        err \"The laws of the universe are broken\"\n    }"
    48  }
    49  ```
    50  
    51  ## See Also
    52  
    53  * [Code Block Parsing](../user-guide/code-block.md):
    54    Overview of how code blocks are parsed
    55  * [`%(Brace Quote)`](../parser/brace-quote.md):
    56    Initiates or terminates a string (variables expanded)
    57  * [`%[]` Create Array](../parser/create-array.md):
    58    Quickly generate arrays
    59  * [`%{}` Create Map](../parser/create-object.md):
    60    Quickly generate objects and maps
    61  * [`[[ Element ]]`](../parser/element.md):
    62    Outputs an element from a nested structure
    63  * [`autocomplete`](../commands/autocomplete.md):
    64    Set definitions for tab-completion in the command line
    65  * [`cast`](../commands/cast.md):
    66    Alters the data type of the previous function without altering it's output
    67  * [`config`](../commands/config.md):
    68    Query or define Murex runtime settings
    69  * [`format`](../commands/format.md):
    70    Reformat one data-type into another data-type
    71  * [`hcl`](../types/hcl.md):
    72    HashiCorp Configuration Language (HCL)
    73  * [`json`](../types/json.md):
    74    JavaScript Object Notation (JSON)
    75  * [`jsonc`](../types/jsonc.md):
    76    Concatenated JSON
    77  * [`jsonl`](../types/jsonl.md):
    78    JSON Lines
    79  * [`open`](../commands/open.md):
    80    Open a file with a preferred handler
    81  * [`pretty`](../commands/pretty.md):
    82    Prettifies JSON to make it human readable
    83  * [`runtime`](../commands/runtime.md):
    84    Returns runtime information on the internal state of Murex
    85  * [`toml`](../types/toml.md):
    86    Tom's Obvious, Minimal Language (TOML)
    87  * [`yaml`](../types/yaml.md):
    88    YAML Ain't Markup Language (YAML)
    89  * [`{ Curly Brace }`](../parser/curly-brace.md):
    90    Initiates or terminates a code block
    91  * [index](../parser/item-index.md):
    92    Outputs an element from an array, map or table
    93  
    94  ### Read more about type hooks
    95  
    96  - [`ReadIndex()` (type)](../apis/ReadIndex.md): Data type handler for the index, `[`, builtin
    97  - [`ReadNotIndex()` (type)](../apis/ReadNotIndex.md): Data type handler for the bang-prefixed index, `![`, builtin
    98  - [`ReadArray()` (type)](../apis/ReadArray.md): Read from a data type one array element at a time
    99  - [`WriteArray()` (type)](../apis/WriteArray.md): Write a data type, one array element at a time
   100  - [`ReadMap()` (type)](../apis/ReadMap.md): Treat data type as a key/value structure and read its contents
   101  - [`Marshal()` (type)](../apis/Marshal.md): Converts structured memory into a structured file format (eg for stdio)
   102  - [`Unmarshal()` (type)](../apis/Unmarshal.md): Converts a structured file format into structured memory
   103  
   104  <hr/>
   105  
   106  This document was generated from [builtins/types/json/mxjson_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/types/json/mxjson_doc.yaml).