Esempio n. 1
0
        public User(string jsonString) : this()
        {
            JsonObject jsonObject = JsonObject.Parse(jsonString);

            Id = jsonObject.GetNamedString(idKey, "");

            IJsonValue phoneJsonValue = jsonObject.GetNamedValue(phoneKey);

            if (phoneJsonValue.ValueType == JsonValueType.Null)
            {
                Phone = null;
            }
            else
            {
                Phone = phoneJsonValue.GetString();
            }

            Name     = jsonObject.GetNamedString(nameKey, "");
            Timezone = jsonObject.GetNamedNumber(timezoneKey, 0);
            Verified = jsonObject.GetNamedBoolean(verifiedKey, false);

            foreach (IJsonValue jsonValue in jsonObject.GetNamedArray(educationKey, new JsonArray()))
            {
                if (jsonValue.ValueType == JsonValueType.Object)
                {
                    Education.Add(new School(jsonValue.GetObject()));
                }
            }
        }