Newtonsoft.Json.JsonReader.Skip C# (CSharp) Method

Skip() public method

Skips the children of the current token.
public Skip ( ) : void
return void
        public void Skip()
        {
            if (TokenType == JsonToken.PropertyName)
            {
                Read();
            }

            if (JsonTokenUtils.IsStartToken(TokenType))
            {
                int depth = Depth;

                while (Read() && (depth < Depth))
                {
                }
            }
        }

Usage Example

        public static DubProjectConfiguration DeserializeFromPackageJson(JsonReader j)
        {
            var c = new DubProjectConfiguration { Name = "<Undefined>" };

            var srz = new JsonSerializer();
            while (j.Read() && j.TokenType != JsonToken.EndObject)
            {
                if (j.TokenType == JsonToken.PropertyName)
                {
                    switch (j.Value as string)
                    {
                        case "name":
                            c.Name = c.Id = j.ReadAsString();
                            break;
                        case "platforms":
                            j.Read();
                            c.Platform = string.Join("|",srz.Deserialize<string[]>(j));
                            break;
                        default:
                            if (!c.BuildSettings.TryDeserializeBuildSetting(j))
                                j.Skip();
                            break;
                    }
                }
            }

            return c;
        }
All Usage Examples Of Newtonsoft.Json.JsonReader::Skip