I’m passing a string (JSON) as a parameter to a report, then parsing it into separate data sources.
Example JSON string
"{'ignored': 1511, 'failed': [['style', 1234567], ['style2', 9658234]], 'success': 2531}"
My parsing script fails with error Line 10: list indices must be integers
, but I don’t follow. The script works fine in the console.
jsonStr = data['jsonString']
resultDict = system.util.jsonDecode(jsonStr)
# create dataset from failed items
header = ['style','serial']
data = resultDict['failed']
data['failed'] = system.dataset.toDataSet(header,data) // line 10
//data['ignored'] = resultDict['ignored']
//data['success'] = resultDict['success']