So in unity im getting the json parse error missing a name for object member in the console. I looked up similar cases and it seems to be that json has to be double quoted. So instead of my original simple "{"layout":"xxxxxx"}" json in my txt file I put "{""layout"":""xxxxxx""}" and now I get json parse error the document root must not follow by other values which I dont know what it means. Here is my relevant C# code
[Serializable]
public class ConfigData
{
string layout;
}
public class GM : MonoBehaviour {
public void Setup()
{
string path = "Assets/bricks.txt";
string brickStr = File.ReadAllText (path);
ConfigData configObj = new ConfigData ();
configObj = JsonUtility.FromJson<ConfigData>(brickStr);
Debug.Log ("serialized: " + configObj);
}
}