In flutter(dart), it is easy to deserialize Json
and get a token from it, but when I try to serialize it again, the quotation marks around the keys and values with disappear.
String myJSON = '{"name":{"first":"foo","last":"bar"}, "age":31, "city":"New York"}';
var json = JSON.jsonDecode(myJSON); //_InternalLinkedHashMap
var nameJson = json['name']; //_InternalLinkedHashMap
String nameString = nameJson.toString();
Although the nameJson
have all the double quotations, the nameString
is
{first: foo, last: bar}
(true answer is {"first": "foo", "last": "bar"}
)
how to preserve Dart to remove the "
s?