Created
September 30, 2019 12:03
-
-
Save janstol/cf2fc82a77eb30a12106abc0317a28d6 to your computer and use it in GitHub Desktop.
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 jsonString = ''' | |
{ | |
ModuleEId: [ | |
[ | |
"Test Equipment - R&D", | |
"GPU_0001_180 KVA Dual AC 28.5V DC" | |
], | |
[ | |
"Test Equipment - Electronics", | |
"GPU_0004_180 KVA Dual AC 28.5 V DC" | |
] | |
] | |
} | |
'''; | |
// fix json format | |
jsonString = jsonString.replaceAll('ModuleEId', '"ModuleEId"'); | |
// parse json | |
final parsed = json.decode(jsonString); | |
print("Parsed: $parsed \n"); | |
// iterate through array and print elements | |
for (final a in parsed['ModuleEId']) { | |
for (final b in a) { | |
print(b); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment