I currently have a variable of type object
.
let ref_schema_data: object
The value of ref_schema_data
:
{ '$schema': 'http://json-schema.org/draft-07/schema',
'$id': 'tc_io_schema_top.json',
allOf:
[ { type: 'object', required: [Array], properties: [Object] } ] }
This is how I am assigning a value to ref_schema_data
:
function load_schema(filename: string, filepath: string):object {
let json_data = fs.readFileSync(path.join(filepath, filename),'utf8')
return JSON.parse(json_data)
}
I am having trouble retrieving values from the object by key. For example, I am trying to retrieve ref_schema_data["$id"]
, but it's not working.
What mistake am I making?