{"record":{"id":"6d0d79c4b47ea2a1","repo":"qishibo/AnotherRedisDesktopManager","slug":"this-t-message-json-format-failed-6d0d79","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/KeyContentReJson.vue","lineNumber":49,"sourceCode":"  },\n  props: ['client', 'redisKey', 'hotKeyScope'],\n  components: { FormatViewer },\n  methods: {\n    initShow() {\n      this.client.callBuffer('JSON.GET', [this.redisKey]).then((reply) => {\n        this.content = reply;\n      });\n    },\n    execSave() {\n      const content = this.$refs.formatViewer.getContent();\n\n      // viewer check failed, do not save\n      if (content === false) {\n        return;\n      }\n\n      if (!this.$util.isJson(content)) {\n        return this.$message.error(this.$t('message.json_format_failed'));\n      }\n\n      this.client.call('JSON.SET', [this.redisKey, '$', content]).then((reply) => {\n        if (reply === 'OK') {\n          this.setTTL();\n          this.initShow();\n\n          this.$message.success({\n            message: this.$t('message.modify_success'),\n            duration: 1000,\n          });\n        } else {\n          this.$message.error({\n            message: this.$t('message.modify_failed'),\n            duration: 1000,\n          });\n        }\n      }).catch((e) => {","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/qishibo/AnotherRedisDesktopManager/blob/c149855106628babcdfb7675a8e7ba9434d2492a/src/components/contents/KeyContentReJson.vue#L31-L67","documentation":"Pure client-side validation: before sending JSON.SET, the component runs the edited text through $util.isJson (a JSON.parse check). 'json_format_failed' means the parse threw, so nothing is sent to Redis and the stored document is untouched. This is strict RFC 8259 JSON — JSON5/JS object literals are rejected.","triggerScenarios":"Trailing commas, single-quoted strings, unquoted keys, comments, NaN/Infinity literals, or truncated text left in the viewer after editing; content pasted from JavaScript source rather than JSON.","commonSituations":"Documents produced by json.dumps with non-strict extensions; users pasting JS config objects; very large documents truncated by the viewer's size limit and then saved.","solutions":["Click the format button or paste the text into a JSON linter to locate the offending offset","Fix strict-JSON violations: double quotes everywhere, no trailing commas, no comments","If the source is JSON5/relaxed JSON, convert it to strict JSON before saving"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"try {\n  JSON.parse(content);\n} catch (e) {\n  return this.$message.error(`Invalid JSON at: ${e.message}`);\n}","typeGuard":"function isJson(str) {\n  if (typeof str !== 'string' || !str.trim()) return false;\n  try { JSON.parse(str); return true; } catch (_) { return false; }\n}","tryCatchPattern":null,"preventionTips":["Always validate with JSON.parse before JSON.SET — never trust edited textarea content","Surface the parse error's position (e.message contains it) so users can find the bad offset","Run a formatter before saving; formatting failure is itself the validation signal"],"tags":["json","validation","redisjson","vue"],"backgroundTag":"json-parse-error","analyzedSha":"c149855106628babcdfb7675a8e7ba9434d2492a","analyzedAt":"2026-08-22T09:06:28.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}