SHARE
TWEET

Untitled

a guest Oct 18th, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'dart:convert';
  2.  
  3. void main() {
  4.   String jsonString = '''
  5.     {
  6.       ModuleEId: [
  7.         [
  8.           "Test Equipment - R&D",
  9.           "GPU_0001_180 KVA Dual AC 28.5V DC"
  10.         ],
  11.         [
  12.           "Test Equipment - Electronics",
  13.           "GPU_0004_180 KVA Dual AC 28.5 V DC"
  14.         ]
  15.       ]
  16.     }
  17.     ''';
  18.  
  19.   // fix json format
  20.   jsonString = jsonString.replaceAll('ModuleEId', '"ModuleEId"');
  21.  
  22.   // parse json
  23.   final parsed = json.decode(jsonString);
  24.  
  25.   print("Parsed: $parsed \n");
  26.  
  27.   // iterate through array and print elements
  28.   for (final a in parsed['ModuleEId']) {
  29.     for (final b in a) {
  30.       print(b);
  31.     }
  32.   }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top