vega-lite-api

vl.json(…values)

Define a data source for json format data.

The behavior of this method depends on the argument type:

json Method Overview

json API Reference

# json.name(name)

A name for this data source. Use this name to update the data via the runtime API.

# json.parse(value)

If set to null, disable type inference based on the spec and only use type inference based on the data. Alternatively, a parsing directive object can be provided for explicit data types. Each property of the object corresponds to a field name, and the value to the desired data type (one of "number", "boolean", "date", or null (do not parse the field)). For example, "parse": {"modified_on": "date"} parses the modified_on field in each input record a Date value.

For "date", we parse data based using JavaScript’s Date.parse(). For Specific date formats can be provided (e.g., {foo: "date:'%m%d%Y'"}), using the d3-time-format syntax. UTC date format parsing is supported similarly (e.g., {foo: "utc:'%m%d%Y'"}). See more about UTC time

# json.property(value)

The JSON property containing the desired data. This parameter can be used when the loaded JSON file may have surrounding structure or meta-data. For example "property": "values.features" is equivalent to retrieving json.values.features from the loaded JSON object.

# json.type(value)

Type of input data: "json", "csv", "tsv", "dsv".

Default value: The default format type is determined by the extension of the file URL. If no extension is detected, "json" will be used by default.

# json.url(url)

A URL from which to load the data.

# json.values(values)

Provide loaded data values directly.

The behavior of this method depends on the argument type: