ID:2048264
 
Code:
/proc/load_strings_file(filename)
string_filename_current_key = filename
if(filename in string_cache)
return //no work to do

if(!string_cache)
string_cache = new

if(fexists("strings/[filename]"))
string_cache[filename] = json_decode("strings/[filename]")
else
CRASH("file not found: strings/[filename]")


Problem description:
I have the following line of code for loading a set of text strings (in this case npc chatter) from a json file.

edit: I just realised that this might offend sensitive people, so if you are sensitive, do not open this

https://file.house/slTJ.json file in question

However, all I ever get is an unknown value runtime

runtime error: Unknown value: 0
proc name: load strings file (/proc/load_strings_file)
source file: _string_lists.dm,36
usr: (src)
src: null
call stack:
load strings file("npc_chatter.json")

I even tried reformatting the json file to have no pretty spacing or layout and that had no effect.

Is anyone able to shed light on what I'm missing here? This JSON is RFC compliant so I'm guessing there's some byond limitation at play that I'm not aware of?
for reference, line 36 is
string_cache[filename] = json_decode("strings/[filename]")
I've realised that this is probably because I should use file2text to read the file before handing it to json_decode

herp.

In response to Optimumtact
Yep, that's it. json_decode() acts on a string directly, not on a file.