using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RecData
{
   public class GetVal
    {

        public static string JObject_Value(JObject jObj,string name)
        {
            var objVal = "NULL";
            if (jObj[name] != null)
            {
                objVal = jObj[name].ToString();
            }
            return objVal;
        }
        public static string JObject_Value_Int(JObject jObj, string name)
        {
            var objVal = "-1";
            if (jObj[name] != null)
            {
                objVal = jObj[name].ToString();
            }
            return objVal;
        }
        public static string JToken_Value(JToken jToken, string name)
        {
            var objVal = "NULL";
            var jTokenStr = jToken.ToString();
            if (!jTokenStr.Contains(name))
            {
                return objVal;
            }

            if (jToken[name] != null)
            {
                objVal = jToken[name].ToString();
            }
            return objVal;
          
        }
        public static string JToken_Value_Int(JToken jToken, string name)
        {
            var objVal = "-1";
            if (jToken[name] != null)
            {
                objVal = jToken[name].ToString();
            }
            return objVal;

        }
        public static JArray JObject_JArray(JObject jObj, string name)
        {
            var jArray = new JArray();
            if (jObj[name] != null)
            {
                jArray = (JArray)jObj[name];
            }
            return jArray;
        }


    }
}
