{"record":{"id":"1c1fcc89e588aa1e","repo":"qishibo/AnotherRedisDesktopManager","slug":"this-t-message-json-format-failed-1c1fcc","errorCode":null,"errorMessage":"this.$t('message.json_format_failed')","messagePattern":"this\\.\\$t\\('message\\.json_format_failed'\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/components/contents/KeyContentStream.vue","lineNumber":333,"sourceCode":"        }\n\n        return `${command} ${dicts.join(' ')}`;\n      });\n\n      // reverse: id asc order\n      this.$util.copyToClipboard(params.reverse().join('\\n'));\n      this.$message.success({ message: this.$t('message.copy_success'), duration: 800 });\n    },\n    editLine() {\n      const afterId = this.editLineItem.id;\n      const afterValue = this.$refs.formatViewer.getContent();\n\n      if (!afterId || !afterValue) {\n        return;\n      }\n\n      if (!this.$util.isJson(afterValue)) {\n        return this.$message.error(this.$t('message.json_format_failed'));\n      }\n\n      const mapList = [];\n      const jsonObj = JSON.parse(afterValue);\n\n      for (const k in jsonObj) {\n        mapList.push(...[k, jsonObj[k]]);\n      }\n\n      this.client.xadd(\n        this.redisKey,\n        afterId,\n        mapList,\n      ).then((reply) => {\n        // reply is id\n        if (reply) {\n          // this.initShow(); // do not reinit, #786\n          const newLine = { id: reply, content: jsonObj, contentString: afterValue };","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/qishibo/AnotherRedisDesktopManager/blob/c149855106628babcdfb7675a8e7ba9434d2492a/src/components/contents/KeyContentStream.vue#L315-L351","documentation":"Application-level validation toast ('Json Parse Failed') in KeyContentStream.vue:333. Before saving an edited stream entry, editLine() runs $util.isJson(afterValue); if the editor content is not parseable JSON the XADD is never sent. This exists because the stream editor models entry fields as a JSON object (JSON.parse + flattened field/value pairs into mapList for xadd), so non-JSON content cannot be represented.","triggerScenarios":"Triggered when the editor content has trailing commas, single quotes, unquoted keys, comments, or a truncated paste; when editing an entry whose stored contentString was not valid JSON in the first place (field names collide or binary-ish values broke round-trip); or when autoFormat produced an empty/placeholder buffer.","commonSituations":"Hand-editing copied stream payloads; entries serialized by producers using non-strict JSON; large payloads where the monaco editor content was only partially loaded; newline/trailing whitespace accidents.","solutions":["Run the content through a strict JSON validator (jsonlint) and fix highlighted spots — keys in double quotes, no trailing commas","Use the format button in the viewer to auto-pretty-print valid JSON before editing","If the original entry is not valid JSON, edit it as a whole-string strategy or rewrite it via console XADD","Ensure the value is an object at top level, not an array or scalar, so field/value pairs can be derived"],"exampleFix":"// before\nif (!this.$util.isJson(afterValue)) {\n  return this.$message.error(this.$t('message.json_format_failed'));\n}\nconst jsonObj = JSON.parse(afterValue);\n\n// after: show why parsing failed and require a plain object\nlet jsonObj = null;\ntry { jsonObj = JSON.parse(afterValue); } catch (e) {\n  return this.$message.error(`${this.$t('message.json_format_failed')}: ${e.message}`);\n}\nif (!jsonObj || jsonObj.constructor !== Object || Array.isArray(jsonObj)) {\n  return this.$message.error(this.$t('message.json_format_failed'));\n}","handlingStrategy":"type-guard","validationCode":"const parsed = tryParseJson(afterValue);\nif (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {\n  return this.$message.error(this.$t('message.json_format_failed'));\n}","typeGuard":"// narrows editor text to a JSON plain object suitable for XADD field pairs\nfunction tryParseJson(text) {\n  try {\n    const v = JSON.parse(text);\n    return v !== null && typeof v === 'object' && !Array.isArray(v) ? v : null;\n  } catch (e) {\n    return null;\n  }\n}","tryCatchPattern":"let jsonObj;\ntry { jsonObj = JSON.parse(afterValue); }\ncatch (e) { return this.$message.error(`${this.$t('message.json_format_failed')}: ${e.message}`); }","preventionTips":["Always pretty-print/format in the viewer before editing so syntax slips are visible","Require a top-level object — arrays/scalars cannot map to stream field/value pairs","Paste payloads through a strict JSON linter first"],"tags":["json","validation","stream-editor","ardm"],"backgroundTag":"json-parse-failed","analyzedSha":"c149855106628babcdfb7675a8e7ba9434d2492a","analyzedAt":"2026-08-22T09:06:28.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}