Load JSON Resource as TextAsset

Hello, I’m trying to load a text file that contains JSON data as a TextAsset. This works fine if the extension of .txt is used,

For example myJson.txt works with:

TextAsset t = (TextAsset) Resources.Load(“myJson”, typeof(TextAsset));

However, when the extension is changed to .json, the resource will not load. How can we load the file as a TextAsset despite the .json extension? Is there a better way to load text from a file on runtime?

I think you are fine with the code, the problem is support:

Text Assets are a format for imported text files. When you drop a text file into your Project Folder, it will be converted to a Text Asset. The supported text formats are:

.txt
.html
.htm
.xml
.bytes

Something to ask be added as it is a more common “text” file format now.

Agreed - it would be nice if we could modify the list of file extensions associated with each Asset type. I get that it’s a slightly more advanced feature, but it would help future-proof the system very nicely.

Just to confirm - there is still no way to load a file with a .json extension as a Text Asset, is there?

Just save it as .txt