OutputFormat

1
2
3
4
5
{
    "Name": "RESTar.Admin.OutputFormat",
    "Kind": "EntityResource",
    "Methods": ["GET", "POST", "PATCH", "PUT", "DELETE", "REPORT", "HEAD"]
}

The OutputFormat resource contains all available JSON ouput formats used by RESTar when serializing response bodies of GET requests. An output format is essentially a JSON object tree that contains exactly one occurrence of the $data macro (not to be confused with RESTar macros in general). The $data macro is used simply to define where in the JSON tree to insert the entity array generated when serializing the output from the GET request.

Format

Property name Type Description
Name string The name of the output format
Pattern string The output format pattern
IsDefault boolean Is this the default output format?
Example object (read-only) An example of how output would be serialized with this format

Output format pattern

Formats are written as escaped JSON strings, and need to contain exactly one occurrence of the $data macro – specifying where to insert the JSON array generated by the GET request.

Example:

1
"Pattern": "{\"Data_array\":$data}"

Serializing data with the pattern above would result in the following JSON object tree:

1
2
3
4
5
6
7
8
9
10
11
12
{
    "Data_array": [
        {
            "Property1": "SomeValue",
            "Property2": "SomeOtherValue"
        },
        {
            "Property1": "SomeValue",
            "Property2": "SomeOtherValue"
        }
    ]
}