using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace cuidian.OpenApi.Utils { public class ApiList { private JArray array; public ApiList(JArray array) { this.array = array; } public JArray GetJArray() { return array; } public IList GetArray() { return array; } public int Count { get { return array.Count; } } public ApiDictionary this[int index] { get { return this.GetObject(index); } } public ApiDictionary GetObject(int index) { Type t = array[index].GetType(); if (t.FullName.Equals("Newtonsoft.Json.Linq.JObject", StringComparison.CurrentCultureIgnoreCase)) { return JsonConvert.DeserializeObject(array[index].ToString()); } return null; } public override string ToString() { return JsonConvert.SerializeObject(array); } } }