Logo

Programming-Idioms

History of Idiom 91 > diff from v5 to v6

Edit summary for version 6 by :

Version 5

2015-09-24, 12:19:31

Version 6

2015-10-28, 01:56:06

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
use File::Slurp;
use JSON;
Code
my $str = read_file('data.json');
my $x = decode_json($str);