How Can I Read JSON File Contents in Templater Script in Obsidian?

Hey everyone,

I'm trying to read the contents of a JSON file in an Obsidian note using a Templater script. I’m familiar with Templater and basic scripting, but I’m not sure of the best way to load and parse a JSON file.

Here’s what I have so far:

const exerciseFile = tp.file.find_tfile("test.json");

I can locate the file, but I’m unsure how to read its content properly. I assume it involves using JavaScript's `fs` module or another method, but I’m not entirely clear on the process within Templater's environment.

Any tips or examples on how to:

  1. Load the JSON file.
  2. Parse its contents for use in the script.

Thanks in advance for the help!