Last active
January 19, 2022 10:11
-
-
Save ekopradesga/2b71eb828a548541d854ca7d069798ec to your computer and use it in GitHub Desktop.
Search JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:convert'; | |
void main() { | |
String jsonStr = '[{"asset":"BTC","free":0,"locked":0},{"asset":"LTC","free":0,"locked":0},{"asset":"ETH","free":0,"locked":0},{"asset":"NEO","free":0,"locked":0},{"asset":"BNB","free":0.75884444,"locked":0},{"asset":"QTUM","free":0,"locked":0},{"asset":"EOS","free":0,"locked":0},{"asset":"SNT","free":0,"locked":0},{"asset":"BNT","free":0,"locked":0},{"asset":"GAS","free":0,"locked":0},{"asset":"BCC","free":0,"locked":0},{"asset":"USDT","free":1633.6586226,"locked":0},{"asset":"HSR","free":0,"locked":0},{"asset":"OAX","free":0,"locked":0},{"asset":"DNT","free":0,"locked":0},{"asset":"MCO","free":0,"locked":0},{"asset":"ICN","free":0,"locked":0},{"asset":"ZRX","free":0,"locked":0},{"asset":"OMG","free":0,"locked":0}]'; | |
List<Map<String, dynamic>> data = jsonDecode(jsonStr); | |
Map<String, dynamic> dt = data.firstWhere((dat) => dat['asset'] == 'USDT'); | |
print(dt['free']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment