// convert array of person info to json public JObject ToJSON() { PersonInfoArray personInfoArray = new PersonInfoArray(); personInfoArray.personInfos = new PersonInfo[personInfoList.Count]; for (int i = 0; i < personInfoList.Count; i++) { personInfoArray.personInfos[i] = personInfoList[i]; } return(JObject.FromObject(personInfoArray)); }
public void LoadFromJSON(JToken mapMetadata) { Clear(); if (mapMetadata is JObject && mapMetadata[jsonKey] is JObject) { PersonInfoArray personInfoArray = mapMetadata[jsonKey].ToObject <PersonInfoArray>(); if (personInfoArray.personInfos == null) { Debug.Log("No People"); return; } // populate the object and info Lists foreach (var info in personInfoArray.personInfos) { personInfoList.Add(info); Person person = PersonFromInfo(info); personObjList.Add(person); } } }