- DocumentID: Unmarshal
  Title: >-
    `Unmarshal()` (type)
  CategoryID: apis
  Summary: >-
    Converts a structured file format into structured memory
  Description: |-
    This is a function you would write when programming a Murex data-type.
    The unmarshal function takes in a byte slice and returns a Go (golang)
    `type` or `struct` or an error.

    This unmarshaller is then registered to Murex inside an `init()` function
    and Murex builtins can use that unmarshaller via the `UnmarshalData()`
    API.
  Usage: |-
    Registering `Unmarshal()` (for writing builtin data-types)
    
    ```go
    // To avoid data races, this should only happen inside func init()
    lang.Unmarshallers[ /* your type name */ ] = /* your readIndex func */
    ```

    Using an existing unmarshaller (eg inside a builtin command)

    ```go
    // See documentation on lang.UnmarshalData for more details
    v, err := lang.UnmarshalData(p *lang.Process, dataType string)
    ```
  Examples: |-
    Defining a marshaller for a murex data-type

    ```go
    {{ include "builtins/types/example/unmarshal.go" }}
    ```
  Detail: |-
  Parameters:
  - "`*lang.Process`: Process's runtime state. Typically expressed as the variable `p` "
  Related:
  - lang.MarshalData
  - lang.UnmarshalData
  - Marshal


- DocumentID: lang.UnmarshalData
  Title: >-
    `lang.UnmarshalData()` (system API)
  CategoryID: apis
  Summary: >-
    Converts a Murex data-type into structured memory
  Description: |-
  Usage: |-
    ```go
    data, err := lang.UnmarshalData(p, dataType)
    ```
  Examples: |-
    ```go
    func exampleCommand(p *lang.Process) error {
        data := string `{ "foo": "hello foo", "bar": "hello bar" }`

        dataType := "json"

        v, err := lang.UnmarshalData(p, dataType)
        if err != nil {
            return err
        }

        s := fmt.Sprint(v)
        _, err := p.Stdout.Write([]byte(s))
        return err
    }
    ```
  Detail: |-
    Go source file:
    
    ```go
    {{ include "lang/define_unmarshal.go" }}
    ```
  Parameters:
  - "`*lang.Process`: Process's runtime state. Typically expressed as the variable `p` "
  - "`string`: Murex data type" 
  Related:
  - Marshal
  - lang.MarshalData
  - Unmarshal