data[i]['title']= {varent_pos: 1, varent_ct: 0, title: Aashirvaad Atta with Multigrains pouch, imageslist: [], varent_id: null, id: 43469930505}
try {
final parsed = json.decode(data[i]['title']);
} on FormatException catch (e) {
print("That string didn't look like Json.");
} on NoSuchMethodError catch (e) {
print('That string was null!');
}"
但它显示“那个字符串看起来不像 Json”
print(data[i]['title']);
{varent_pos: 1, varent_ct: 0, title: Aashirvaad Atta with Multigrains pouch, imageslist: [], varent_id: null, id: 43469930505}
最佳答案
首先尝试打印 data[i]['title'] 的内容以确保它是一个字符串并且看起来有效。
之后您可以尝试通过 https://jsonlint.com/ 运行 JSON那个 linter。
最后但不是列表尝试在 catch 语句中打印实际异常,也许它包含更多有用的信息。
关于dart - json字符串转换问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54976325/