如何将映射转换为字符串?

时间:2019-09-06 11:20:04

标签: flutter dart

我的obj是:

Map myJSON = {
  "name": {"first":"foo","last":"bar"}, 
  "age":31, "city":"New York"
}; 

我想用新的输出Ex代替它:

String myJSON = '{"name":{"first":"foo","last":"bar"}, "age":31, "city":"New York"}';

2 个答案:

答案 0 :(得分:0)

  String jsonString = jsonEncode(myJSON);
  print(jsonString);

答案 1 :(得分:0)

使用Func.refGene

 >dput(df)
 structure(list(Chr = c("chr1", "chr1", "chr1", "chr1", "chr1", 
 "chr1", "chr1", "chr1", "chr1", "chr1", "chr1", "chr1", "chr1", 
 "chr1", "chr1"), Start = c(69511L, 876499L, 877831L, 878314L, 
 879676L, 879676L, 879687L, 879687L, 881627L, 887560L, 887801L,  
 888639L, 888659L, 889158L, 889159L), End = c(69511L, 876499L, 
 877831L, 878314L, 879676L, 879676L, 879687L, 879687L, 881627L, 
 887560L, 887801L, 888639L, 888659L, 889158L, 889159L), GATK.RefCount   = c("0", 
"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", 
"0"), GATK.AltCount = c("55", "60", "138", "184", "111", "111", 
"110", "110", "103", "66", "138", "73", "50", "96", "96"), GATK.Filter = c("MQ_LT_40", 
"PASS", "PASS", "PASS", "PASS", "PASS", "PASS", "PASS", "PASS", 
"PASS", "PASS", "PASS", "PASS", "PASS", "PASS"), Func.refGene =   c("exonic", 
"intronic", "exonic", "exonic", "UTR3", "UTR3", "UTR3", "UTR3", 
 "exonic", "intronic", "exonic", "exonic", "exonic",   "splicing;intronic", 
 "splicing;intronic"), Gene.refGene = c("OR4F5", "SAMD11", "SAMD11", 
 "SAMD11", "NOC2L", "SAMD11", "NOC2L", "SAMD11", "NOC2L", "NOC2L", 
 "NOC2L", "NOC2L", "NOC2L", "NOC2L", "NOC2L"), GeneDetail.refGene = c(".", 
 ".", ".", ".", "NM_015658:c.*398C>T;NM_152486:c.*143G>A",    "NM_015658:c.*398C>T;NM_152486:c.*143G>A", 
"NM_015658:c.*387A>G;NM_152486:c.*154T>C",     "NM_015658:c.*387A>G;NM_152486:c.*154T>C", 
 ".", ".", ".", ".", ".", "NM_015658:exon8:c.888+4C>G",     "NM_015658:exon8:c.888+3T>G"
 )), row.names = c(NA, 15L), class = "data.frame")

将字符串转换为Map

convert

将地图转换为字符串

import 'dart:convert';