json_load

compas.data.json_load(fp)[source]

Read COMPAS object data from a JSON file.

Parameters:
fppath string | file-like object | URL string

A readable path, a file-like object or a URL pointing to a file.

Returns:
object

The (COMPAS) data contained in the file.

Examples

>>> import compas
>>> from compas.geometry import Point, Vector
>>> data1 = [Point(0, 0, 0), Vector(0, 0, 0)]
>>> compas.json_dump(data1, "data.json")
>>> data2 = compas.json_load("data.json")
>>> data1 == data2
True