{"record":{"id":"12d99426a8e02fcd","repo":"JamesNK/Newtonsoft.Json","slug":"property-0-does-not-exist-on-jobject","errorCode":null,"errorMessage":"Property '{0}' does not exist on JObject.","messagePattern":"Property '(.+?)' does not exist on JObject\\.","errorType":"exception","errorClass":"JsonException","httpStatus":null,"severity":"error","filePath":"Src/Newtonsoft.Json/Linq/JsonPath/FieldFilter.cs","lineNumber":32,"sourceCode":"        }\n\n        public override IEnumerable<JToken> ExecuteFilter(JToken root, IEnumerable<JToken> current, JsonSelectSettings? settings)\n        {\n            foreach (JToken t in current)\n            {\n                if (t is JObject o)\n                {\n                    if (Name != null)\n                    {\n                        JToken? v = o[Name];\n\n                        if (v != null)\n                        {\n                            yield return v;\n                        }\n                        else if (settings?.ErrorWhenNoMatch ?? false)\n                        {\n                            throw new JsonException(\"Property '{0}' does not exist on JObject.\".FormatWith(CultureInfo.InvariantCulture, Name));\n                        }\n                    }\n                    else\n                    {\n                        foreach (KeyValuePair<string, JToken?> p in o)\n                        {\n                            yield return p.Value!;\n                        }\n                    }\n                }\n                else\n                {\n                    if (settings?.ErrorWhenNoMatch ?? false)\n                    {\n                        throw new JsonException(\"Property '{0}' not valid on {1}.\".FormatWith(CultureInfo.InvariantCulture, Name ?? \"*\", t.GetType().Name));\n                    }\n                }\n            }","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/JamesNK/Newtonsoft.Json/blob/4f73e74372445108d2c1bda37b36e6f5e43402e0/Src/Newtonsoft.Json/Linq/JsonPath/FieldFilter.cs#L14-L50","documentation":"Thrown during JSONPath evaluation when a single property/field filter accesses a named property on a JObject but that property does not exist, and ErrorWhenNoMatch is true. The FieldFilter looked up o[Name] and got null, so it reports the missing property name.","triggerScenarios":"Calling SelectToken(\"$.user.email\", errorWhenNoMatch: true) on a JObject 'user' that has no 'email' property. FieldFilter.cs:30-33 fires when o[Name] returns null and ErrorWhenNoMatch is set.","commonSituations":"Optional fields that are omitted from the response when null; schema version differences where a property was renamed or removed; typos in the path expression's property name.","solutions":["Call SelectToken without errorWhenNoMatch so a missing property returns null instead of throwing.","Verify the property name spelling and case against the actual JSON keys.","Check token[\"user\"]?[\"email\"] using JObject indexing with null-conditional access before querying."],"exampleFix":"// before\ntoken.SelectToken(\"$.user.email\", errorWhenNoMatch: true);\n\n// after\nvar email = token.SelectToken(\"$.user.email\", errorWhenNoMatch: false);\n// email is null if absent, no exception","handlingStrategy":"validation","validationCode":"// Use non-strict mode so a missing property returns null\nvar value = token.SelectToken(\"$.user.email\", errorWhenNoMatch: false);\nif (value == null) { /* handle absence */ }","typeGuard":"static bool HasProperty(JObject obj, string name) => obj[name] != null;","tryCatchPattern":null,"preventionTips":["Default to errorWhenNoMatch=false for optional fields.","Double-check property name spelling and case sensitivity.","Use JObject indexer access with null-conditional operators for optional keys."],"tags":["jsonpath","missing-property","field-filter"],"analyzedSha":"4f73e74372445108d2c1bda37b36e6f5e43402e0","analyzedAt":"2026-08-07T06:10:08.596Z","schemaVersion":2},"datasetVersion":"2026-08-07T07:17:06.508Z"}