json_load

compas.data.json_load(fp)[source]

Read COMPAS object data from a JSON file.

Parameters

fp (path string, file-like object or URL string) – A readable path, a file-like object or a URL pointing to a file.

Returns

data – 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