Skip to content

Instantly share code, notes, and snippets.

@bubnenkoff
Created July 9, 2020 14:06
Show Gist options
  • Save bubnenkoff/eabb9c0fc8c8eb01ffd10827f1a78bbc to your computer and use it in GitHub Desktop.
Save bubnenkoff/eabb9c0fc8c8eb01ffd10827f1a78bbc to your computer and use it in GitHub Desktop.
import 'dart:convert';
main() async {
String str = (r"""{
"id": "22657730",
"purchaseNumber": "0138200004020000001",
"placingWay": "EAP44",
"etp_code": "ETP_RTS",
"lots": [{
"lot_number": "0",
"maxPrice": "1036165",
"currency_code": "RUB",
"objs": [{
"code": "19.20.21.315",
"quantity": "19000",
"price": "50.59"
}]
},
{
"lot_number": "1",
"maxPrice": "6115",
"currency_code": "RUB",
"objs": [{
"code": "42.4115",
"quantity": "7113",
"price": "22.35"
}]
}
]
}""");
Map jsonMapOriginal = jsonDecode(str);
List<String> lotsNumberList = [];
lotsNumberList = jsonMapOriginal['lots'].map((e)=>e['lot_number'].toString()).toList();
print(lotsNumberList);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment