Logo

Programming-Idioms

History of Idiom 91 > diff from v14 to v15

Edit summary for version 15 by :
New Dart implementation by user [ganymede]

Version 14

2015-12-28, 20:29:16

Version 15

2015-12-30, 01:14:15

Idiom #91 Load JSON file into struct

Read from file data.json and write its content into object x.
Assume the JSON data is suitable for the type of x.

Idiom #91 Load JSON file into struct

Read from file data.json and write its content into object x.
Assume the JSON data is suitable for the type of x.

Imports
import 'dart:io' show File;
import 'dart:convert' show JSON;
Code
var x = JSON.decode(await new File('data.json').readAsString());
Comments bubble
x is a Map