Logo

Programming-Idioms

History of Idiom 91 > diff from v8 to v9

Edit summary for version 9 by :
New D implementation by user [piou]

Version 8

2015-10-31, 15:53:15

Version 9

2015-11-04, 00:36:03

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 std.file: readText;
import std.json: parseJSon;
Code
auto x = "data.json".readText.parseJSON;
Doc URL
http://dlang.org/phobos/std_json.html#.parseJSON