/// <summary> /// Converts JObject to JsonObject /// </summary> /// <param name="jObject"></param> /// <returns></returns> public static JsonObject fromJObject(JObject jObject) { JsonObject jsonObject = new JsonObject(); foreach (KeyValuePair <string, JToken> pair in jObject) { jsonObject = JsonObjectFactory.fromJToken(jsonObject, pair.Key, pair.Value); } return(jsonObject); }
/// <summary> /// Converts JArray to JsonObject /// </summary> /// <param name="jArray"></param> /// <returns></returns> public static JsonObject fromJArray(JArray jArray) { JsonObject jsonObject = new JsonObject(true); int index = 0; foreach (JToken item in (IEnumerable <JToken>)jArray) { jsonObject = JsonObjectFactory.fromJToken(jsonObject, index.ToString(), item); index++; } return(jsonObject); }