Skip to content

pencil.js / serialization / from

Function: from() ​

ts
function from<T>(json): T;

Defined in: serialization.ts:51

Construct Pencil.js objects (and their children) from a JSON definition

Type Parameters ​

Type ParameterDefault type
Tany

Parameters ​

ParameterTypeDescription
jsonDefinitionValid JSON definition (from any toJSON call)

Returns ​

T

Example ​

ts
const copy = from(JSON.parse(JSON.stringify(scene)));

Released under the MIT License.