You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use JSON::PP::encode_json. Module JSON::PP is a prereq for JSON5,
so you do not need to install it, you do not need to add a use JSON::PP
into you program. Example:
use JSON5;
my %chem_elem = (H => 1, He => 2, Li => 3);
print JSON::PP::encode_json(\%chem_elem), "\n";
Answer about the context
As mentioned in JSON5.org, JSON5 is aimed at
human-written files, such as config files. In another website (sorry,
I do not remember which website), I have read that JSON v4 is still
relevant for machine-written files and that any program dumping data
as JSON should use the stricter v4 version.
Module JSON5 deals with human-to-machine communication, not
machine-to-machine or machine-to-human communication. So the module
does not support encode. It is lighter, shorter and it follows the
KISS principle (keep it simple, stupid) and Occam's Razor (Entities
must not be multiplied beyond necessity).
Is there any reason why there is no support for
encode
?The text was updated successfully, but these errors were encountered: