示例#1
0
 public Item(dynamic o, DeserializationSession session, Casing casing, bool memberOfList = false)
 {
     Self = o;
     Session = session;
     MemberOfList = memberOfList;
     Casing = casing;
 }
示例#2
0
 public static string Convert(dynamic o, Casing casing)
 {
     var session = new DeserializationSession();
     var item = new Item(o, session, casing);
     item.EnumerateProperties();
     item.Resolve();
     return item.Value;
 }
示例#3
0
        public static string Stringify(dynamic o, Casing casing = null)
        {
            casing = casing ?? new NoCasingChange();

            if (o is Result)
            {
                if (o.ShouldStringify == false) return o.Value;

                if (o.Value is string) return "\"" + Escape(o.Value) + "\"";

                return Stringify(o.Value);
            }

            if (IsNull(o)) return "null";

            if (IsJsonString(o)) return "\"" + casing.Convert(o) + "\"";

            if (IsJsonNumeric(o)) return o.ToString();

            if (IsBool(o)) return o.ToString().ToLower();

            return "\"" + Escape(o) + "\"";
        }
示例#4
0
 public DynamicJsonResult(object data)
 {
     JsonRequestBehavior = JsonRequestBehavior.AllowGet;
     Data   = data;
     Casing = new CamelCasing();
 }
示例#5
0
 public DynamicJsonResult(object data)
 {
     JsonRequestBehavior = JsonRequestBehavior.AllowGet;
     Data = data;
     Casing = new CamelCasing();
 }