public JObjectArray ParseJObjectArray() { m_reader.Next(); JObjectArray result = new JObjectArray(); if (m_reader.Peek() == END_ARRAY) { m_reader.Next(); return(result); } bool run = true; while (run) { object value = ParseObject(); if (m_reader.Peek() == COMMA) { m_reader.Next(); } else { run = false; } result.Add(value); } m_reader.Next(); return(result); }
private JObject SerializeArray(object o, HashSet <object> objects) { var array = o as Array; var result = new JObjectArray(); foreach (var item in array) { result.Add(SerializeAnyObject(item, objects)); } return(result); }
private JObject Serialize(IList collection, HashSet <object> objects) { if (objects.Contains(collection)) { throw new BonaJsonException("Failed to serialize object. Cyclical data structure detected", collection); } objects.Add(collection); var result = new JObjectArray(); foreach (var item in collection) { result.Add(SerializeAnyObject(item, objects)); } objects.Remove(collection); return(result); }
public JObjectArray ParseJObjectArray() { m_reader.Next(); JObjectArray result = new JObjectArray(); if (m_reader.Peek() == END_ARRAY) { m_reader.Next(); return result; } bool run = true; while (run) { object value = ParseObject(); if (m_reader.Peek() == COMMA) { m_reader.Next(); } else { run = false; } result.Add(value); } m_reader.Next(); return result; }