{"record":{"id":"01704674e8933214","repo":"octobercms/october","slug":"broken-json-body-near-str-017046","errorCode":null,"errorMessage":"Broken JSON body near ${str}","messagePattern":"Broken JSON body near (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"modules/system/assets/js/framework.js","lineNumber":2308,"sourceCode":"              stack.push(\"[\");\n            } else if (str[i] === \"]\") {\n              if (stack[stack.length - 1] === \"[\") {\n                stack.pop();\n              } else {\n                throw new Error(\"Broken JSON \" + (str[pos] === \"{\" ? \"object\" : \"array\") + \" body near \" + body);\n              }\n            }\n          }\n          if (!stack.length) {\n            return {\n              originLength: i - pos,\n              body\n            };\n          }\n        }\n        throw new Error(\"Broken JSON \" + (str[pos] === \"{\" ? \"object\" : \"array\") + \" body near \" + body);\n      }\n      throw new Error(\"Broken JSON body near \" + str.substr(pos - 5 >= 0 ? pos - 5 : 0, 50));\n    }\n    canBeKeyHead(ch) {\n      if (ch[0] === \"\\\\\") return false;\n      if (ch[0] >= \"a\" && ch[0] <= \"z\" || ch[0] >= \"A\" && ch[0] <= \"Z\" || ch[0] === \"_\") return true;\n      if (ch[0] >= \"0\" && ch[0] <= \"9\") return true;\n      if (ch[0] === \"$\") return true;\n      if (ch.charCodeAt(0) > 255) return true;\n      return false;\n    }\n    isBlankChar(ch) {\n      return ch === \" \" || ch === \"\\n\" || ch === \"\t\";\n    }\n  };\n\n  // ../../vendor/larajax/larajax/resources/src/core/request-builder.js\n  var RequestBuilder = class _RequestBuilder {\n    constructor(element, handler, options) {\n      this.options = options || {};","sourceCodeStart":2290,"sourceCodeEnd":2326,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/system/assets/js/framework.js#L2290-L2326","documentation":"The catch-all of getBody() in the lenient JSON scanner: the character at the value position matches none of the recognized value starts (quote, t, f, n, digit/+/-/., '{' or '['). Typically an unquoted string value that does not happen to start with t/f/n — the single most common failure when authors write key: value shorthand with text values. The message shows a ~50-character window starting 5 chars before the failure position.","triggerScenarios":"data-request-data=\"status: active\" (wrapped to {status: active}, the 'a' is unrecognized); {ok: True} / {v: False} / {x: Null} — capitalized literals; {a: undefined}; a stray comma or colon in value position ({a: , b: 1}).","commonSituations":"Shorthand attribute configs with unquoted text values (the classic mistake — only true/false/null and numbers may be bare); booleans capitalized by habit from other languages; values copied from PHP ('True') into frontend attributes.","solutions":["Quote all text values: {status: 'active'}.","Lowercase the literals: true / false / null (capitalized variants are treated as unknown tokens).","Remove stray separators (empty value after ':' or ',') — null is allowed as an explicit placeholder."],"exampleFix":"// before\n<a data-request=\"onFilter\" data-request-data=\"status: active\">Active</a>\n\n// after\n<a data-request=\"onFilter\" data-request-data=\"{status: 'active'}\">Active</a>","handlingStrategy":"validation","validationCode":"// Reject capitalized literals and unquoted text values before parsing\nfunction onlyKnownBareValues(value) {\n    var bare = value.replace(/'[^']*'|\"[^\"]*\"/g, '');\n    return bare.match(/:(?:\\s*)(True|False|Null|undefined)\\b/) === null &&\n           bare.match(/:(?:\\s*)(?!true\\b|false\\b|null\\b|-?[\\d.+-])[^\\s,}\\]\\d\"'][^,}\\]]*/) === null;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Quote every string value in data attribute configs; only true/false/null and numbers stay bare.","Lowercase all literals — True/False/Null/undefined are unrecognized tokens.","Generate markup from JS data structures via JSON.stringify where possible."],"tags":["json","parsing","frontend","data-attribute","unquoted-value"],"backgroundTag":"invalid-json-syntax","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}