Content deleted Content added
Polygnotus (talk | contribs) No edit summary |
Polygnotus (talk | contribs) No edit summary |
||
Line 13:
try {
// Look for the surveyData.json content in the module
const
if (
console.log('No survey data found in module');
return [];
}
//
return [];
}
// Find the matching closing bracket
let bracketCount = 0;
let arrayEnd = arrayStart;
for (let i = arrayStart; i < moduleText.length; i++) {
if (moduleText[i] === '[') bracketCount++;
if (moduleText[i] === ']') bracketCount--;
if (bracketCount === 0) {
arrayEnd = i + 1;
break;
}
}
let jsonString = moduleText.substring(arrayStart, arrayEnd);
console.log('Extracted JSON length:', jsonString.length);
console.log('JSON preview:', jsonString.substring(0, 300) + '...');
▲ console.log('Raw JSON found:', jsonString.substring(0, 200) + '...');
const surveyData = JSON.parse(jsonString);
console.log('Found survey data:', surveyData);
|