我想将嵌套的 json 字符串转换为 json 我该怎么做
{2022: {Apr: 100.0}}
// 这是我的字符串 I/flutter (7168): Error FormatException: Unexpected character (at character 2)// 这里出现错误 I/flutter (7168): {2022: {Apr: 100.0}}
jsonDecoder("jsonstring here")
// 我使用了这段代码
首先编码字符串然后解码它
import 'dart:convert';
void main() {
String i = "{2022: {Apr: 100.0}}";
var i2 = json.decode(json.encode(i));
print(i2);
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句