More in this category:
Hashtable hierarchy - SimpleJsonImporter.Import(someJsonString);
ICollection keyColl = hierarchy.Keys;
foreach(string key in keyColl) {
// do something
}
ArrayList level1 = hierarchy.GetArrayList(key, true);
Debug.Log(key + " contains "+level1.Count+" elements");
for(int i=0;i<level1.Count;i++) {
ArrayList arrayContents = level1.GetArrayList(i);
if(arrayContents != null) {
Debug.Log(Found an arraylist at index "+i);
continue;
}
Hashtable hashContents = level1.GetHashtable(i);
if(hashContents != null) {
Debug.Log(Found a hashtable at index "+i);
continue;
}
string stringContents = level1.GetString(i);
if(stringContents != null) {
Debug.Log(Found a string at index "+i);
continue;
}
}
for(int i=0;i<level1.Count;i++) {
object contents = level1[i];
if(contents.GetType() == typeof(ArrayList)) {
Debug.Log(Found an arraylist at index "+i);
} else if(contents.GetType() == typeof(Hashtable)) {
Debug.Log(Found a hashtable at index "+i);
} else if(contents.GetType() == typeof(string)) {
Debug.Log(Found a string at index "+i);
}
}
Hashtable hierarchy - SimpleJsonImporter.Import(someJsonString);
ICollection keyColl = hierarchy.Keys;
foreach(string key in keyColl) {
ArrayList level1 = hierarchy.GetArrayList(key, true);
Debug.Log(key + " contains "+level1.Count+" elements");
for(int i=0;i<level1.Count;i++) {
ArrayList arrayContents = level1.GetArrayList(i);
if(arrayContents != null) {
Debug.Log(Found an arraylist at index "+i);
continue;
}
Hashtable hashContents = level1.GetHashtable(i);
if(hashContents != null) {
Debug.Log(Found a hashtable at index "+i);
continue;
}
string stringContents = level1.GetString(i);
if(stringContents != null) {
Debug.Log(Found a string at index "+i);
continue;
}
}
}