Skip to content

Instantly share code, notes, and snippets.

@janstol
Created September 30, 2019 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janstol/cf2fc82a77eb30a12106abc0317a28d6 to your computer and use it in GitHub Desktop.
Save janstol/cf2fc82a77eb30a12106abc0317a28d6 to your computer and use it in GitHub Desktop.
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