Your file is valid as JSON text, as can for example be verified by pasting the contents into https://jsonlint.com
One way to "load" the JSON file into a javascript interpreter would be as follows. For the sake of specificity, assume the interpreter is v8 or js (JavaScript-C). First, copy the file while prepending something like "x=", e.g.
(echo "x="; cat input.json) > input.js
Now, after starting v8 or js, run: load("input.js")
The variable x will then contain the JSON object.
If you want to trim the key names so that they do not have exterior spaces, you could, for example, run the following jq command:
jq 'with_entries(.key|=(sub("^ +";"")|sub(" +$";"")))' input.json
Object Equality
Based on some comments, it appears you want to check whether the JSON objects in two files are "equal" in the sense of object-equality.
This can be done in a variety of ways. One simple and tidy way would be to use jq as follows:
jq -s '.[0] == .[1]' file1.json file2.json
An alternative would be to write the files in a "canonical" (i.e., normalized) way so that a text-oriented tool such as diff can be used, e.g.
jq -S . file1.json | sponge file1.json
jq -S . file2.json | sponge file2.json
The -S option causes the keys to be sorted in a fixed order; sponge is inessential here but convenient.
jq, being the common/accepted tool for the job.