JSON Lists and Unity

Finally able to access the variables in the JSON file. Why do tutorials not mention that you have to PARSE the loaded file before you can access the variables?

Moving on… I want to put the data that I just loaded and parsed into a List so I can add another item/object and resave the file.

EX-
{“key” , data1}
add a new key, data 2
{“key”, data 1 , “key1” , data2}
Not sure what to use for COUNT in the loop.
Is it the file I just PARSED?
Is it the loaded file’s name?
Or is it something else?

testList.Add(new ClassName(ParsedObject.GetString("ID", ParesedObject.GetString("Description"))));

This is what I would do?
Getting the error GetString takes two arguments.
Converting from SQLite to JSON.
Thanks!

For anyone else that was pulling their hair out, here is the answer!
Thank you to the author of BoomLagoon for the help!

var jsonObject = new JSONObject {
    {"key1", 10 },
    {"key2", "a string" },
    {"keyForAnObject", new JSONObject { { "JustOneKey", 1 } } }
};

foreach (KeyValuePair<string, JSONValue> keyValuePair in jsonObject) {
    Debug.LogFormat("Key: {0} Value: {1}", keyValuePair.Key, keyValuePair.Value);
}

The jsonObject can be a json file that is loaded and parsed, but this is for an example.
Here’s to saving hairstyles all over unityland!