Answers for "dart list map to json"

5

dart list to json

import 'dart:convert';

main() {
  List<String> tags = ['tagA', 'tagB', 'tagC'];
  String jsonTags = jsonEncode(tags);
  print(jsonTags);      // ["tagA","tagB","tagC"]
}
Posted by: Guest on May-19-2021
-1

dart map to json string

import 'dart:convert';
...
json.encode(data); // JSON.encode(data) in Dart 1.x
Posted by: Guest on October-09-2020

Code answers related to "Dart"

Browse Popular Code Answers by Language