in reply to Re^3: JSON to HASH
in thread JSON to HASH
To:sub ServerData { //(package Get; $GSD_JSON = do { open (JSONDATA, "<:encoding(UTF-8)", "/HTTPS/prinet\.org/\.mai +n\.data"); local $/; <JSONDATA> }; close (JSONDATA); $GSD_Handle = JSON->new; return ($GSD_Handle->decode($GSD_JSON)); }
Now all I have to do is figure out how to read the hash in the next routine that updates the json file... *hah*sub ServerData { //(package Get; $GSD_JSON = do { open (JSONDATA, "<:encoding(UTF-8)", "/HTTPS/prinet\.org/\.mai +n\.data"); local $/; <JSONDATA> }; close (JSONDATA); $GSD_Handle = JSON->new; return (%{$GSD_Handle->decode($GSD_JSON)}); }
Which btw does not work...sub ServerData { //package Update; %USD_In = %_; use JSON; open (BUFFER, ">/HTTPS/prinet\.org/\.main\.data"); print BUFFER encode_json(%USD_In); close (BUFFER); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: JSON to HASH
by AnomalousMonk (Archbishop) on May 15, 2016 at 23:23 UTC | |
by PriNet (Monk) on May 16, 2016 at 00:45 UTC |