GetJson(filepath) Last updated: 17. Aug 2023

Loads a JSON file and returns the content as an object.

Parameters

Name Type Description
filepath string Path of JSON (code file) to load as object.

Returns

The file JSON as object.

Example

Code example (JS)

JS is normal JavaScript either running in the browser or on the Docly™ server.
let data = docly.getJson("Test files/Test.json");
data.Added = "I added this property";

return JSON.stringify(data);

Output

The JS code above produces the output shown below:
{"Content":"{\n    \"Description\" : \"This is a test file\"\n}","Added":"I added this property"}