{"record":{"id":"62f74c641a40f3a8","repo":"ElectronNET/Electron.NET","slug":"expected-property-name","errorCode":null,"errorMessage":"Expected property name.","messagePattern":"Expected property name\\.","errorType":"exception","errorClass":"JsonException","httpStatus":null,"severity":"error","filePath":"src/ElectronNET.API/Serialization/JsonToBoxedPrimitivesConverter.cs","lineNumber":31,"sourceCode":"        }\n\n        private static object ReadValue(ref Utf8JsonReader r)\n        {\n            switch (r.TokenType)\n            {\n                case JsonTokenType.StartObject:\n\n                    var obj = new Dictionary<string, object>();\n                    while (r.Read())\n                    {\n                        if (r.TokenType == JsonTokenType.EndObject)\n                        {\n                            return obj;\n                        }\n\n                        if (r.TokenType != JsonTokenType.PropertyName)\n                        {\n                            throw new JsonException(\"Expected property name.\");\n                        }\n\n                        string name = r.GetString()!;\n                        if (!r.Read())\n                        {\n                            throw new JsonException(\"Unexpected end while reading property value.\");\n                        }\n\n                        obj[name] = ReadValue(ref r);\n                    }\n\n                    throw new JsonException(\"Unexpected end while reading object.\");\n\n                case JsonTokenType.StartArray:\n\n                    var list = new List<object>();\n                    while (r.Read())\n                    {","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/ElectronNET/Electron.NET/blob/87cc6f98b6a9c5968d7846c0e775ea713bd0d7b2/src/ElectronNET.API/Serialization/JsonToBoxedPrimitivesConverter.cs#L13-L49","documentation":"JsonToBoxedPrimitivesConverter.ReadValue parses a JSON object into a Dictionary<string, object> of boxed primitives. After reading a start-object token it loops expecting each iteration to begin with a property-name token; any other token inside the object raises this JsonException. It typically indicates malformed or structurally unexpected JSON reaching the converter.","triggerScenarios":"A '{' followed immediately by a value token (e.g. '{123}' or '{,}'), a trailing comma where a property name was expected, or corrupted/truncated JSON inside an object passed through this converter.","commonSituations":"Hand-built JSON in client-side JS with syntax errors; string concatenation building payloads instead of JSON.stringify; truncated IPC messages.","solutions":["Validate the JSON payload with a linter or JSON.parse before sending","Use JSON.stringify instead of manual string construction in JS","Log the raw payload when the error occurs to spot the malformed section","Ensure no trailing commas inside objects"],"exampleFix":"// before\nconst payload = '{ \"width\": 800, }'; // trailing comma\n// after\nconst payload = JSON.stringify({ width: 800 });","handlingStrategy":"try-catch","validationCode":"// sender side\ntry { JSON.parse(payload); } catch (e) { throw new Error('Invalid JSON payload: ' + e.message); }","typeGuard":null,"tryCatchPattern":"try\n{\n    var value = JsonSerializer.Deserialize<object>(json, ElectronJson.Options);\n}\ncatch (JsonException ex)\n{\n    logger.LogWarning(ex, \"Malformed JSON: {Raw}\", json);\n}","preventionTips":["Always build payloads with JSON.stringify, never string concatenation","Lint/validate JSON in dev tooling","Watch for trailing commas in hand-written JSON"],"tags":["json","parsing","malformed"],"backgroundTag":"json-parse-error","analyzedSha":"87cc6f98b6a9c5968d7846c0e775ea713bd0d7b2","analyzedAt":"2026-09-14T03:09:47.608Z","contentChangedAt":"2026-09-14T03:09:47.608Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}