Loading JSON Files in Unity


Ashley Kwon (Spring 2023)

This tutorial shows how to access JSON files in a Unity project with a C# program. Before you begin this tutorial, you need to ensure the following:

string json = Resources.Load<TextAsset>("Json/" + file name without .json);

The folder name "Json" can differ based on the name of the folder where you saved your JSON file. Also, please note that the JSON file name that follows the folder name should be a string without .json. For example, if I want to load a JSON file named data.json, then the file name that follows the folder name in the code above should be "data"