Skip to content

resultsJsonToTable

Load data from a JSON file that contains results from a previous Autory run. Return the table name.

resultsJsonToTable(
    path,
    query="",
    dataTypes=dict()
)

Duplicate column names

If there are multiple columns with the same name, only the left-most column is kept. Column names are case-insensitive. For more info, see the page about column names.

Arguments

path

A string representation of the path to a JSON file that contains results from a previous Autory run.

Both absolute and relative paths are supported. If the path is relative, it's considered relative to the model file (e.g. the model workbook). Environment variables (e.g. %temp% or %homepath%) are also supported.

The expected structure of the JSON file is explained below.

query

An optional query to be applied to the table. See SQL queries for details.

An empty argument or empty string here means that no query will be performed, i.e. all data from the JSON file will be used.

dataTypes

A mapping of column names to data type specifiers. See data types for details.

JSON files only support string, null, bool, float, and int. If the JSON file contains other types represented as strings, like dates, they need to be explicitly specified in this argument, otherwise they will remain strings. Since JSON has explicit support for numeric types, numbers are not auto-detected unless they are specified here.

Results JSON file structure

[ // The outer list contains one item per run.
    {
        // Key-value pairs for scalars, hierarchy properties, and other metadata go here.
        // When converting the JSON to a table, these will be repeated for each time step.
        "valuationType": "Summary",
        "foo": "bar",

        "results": [ // This key is always called "results". It contains one item per time step.
            {
                // Key-value pairs for time vectors go here.
                "Date": "2020-12-31",
                "VarOne": 3.14
            },
            {
                // Another time step …
            }
            // …
        ]
    },
    {
        // Another run …
    }
    // …
]

Examples

See the example workbook.