Example #1
0
        internal static BastionActiveSessionListResult DeserializeBastionActiveSessionListResult(JsonElement element)
        {
            Optional <IReadOnlyList <BastionActiveSession> > value = default;
            Optional <string> nextLink = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <BastionActiveSession> array = new List <BastionActiveSession>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(BastionActiveSession.DeserializeBastionActiveSession(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new BastionActiveSessionListResult(Optional.ToList(value), nextLink.Value));
        }
Example #2
0
        internal static BastionActiveSessionListResult DeserializeBastionActiveSessionListResult(JsonElement element)
        {
            IReadOnlyList <BastionActiveSession> value = default;
            string nextLink = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <BastionActiveSession> array = new List <BastionActiveSession>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        if (item.ValueKind == JsonValueKind.Null)
                        {
                            array.Add(null);
                        }
                        else
                        {
                            array.Add(BastionActiveSession.DeserializeBastionActiveSession(item));
                        }
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new BastionActiveSessionListResult(value, nextLink));
        }