I have this YAML file that I want to convert to JSON:
foo: bar
However, json_xs
doesn't work:
$ json_xs -f yaml -t json < foo.yaml
Can't locate YAML/XS.pm in @INC (you may need to install the YAML::XS
module) (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5
/usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl
/usr/lib64/perl5 /usr/share/perl5) at /usr/bin/json_xs line 187,
<STDIN> line 1.
Redhat Enterprise Linux 8
To fix this on RHEL8, you need to enable the code ready repository:
# subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms
Then, you can install the missing Perl library:
# dnf install perl-YAML-LibYAML
Now, json_xs
works as expected:
# json_xs -f yaml -t json < foo.yaml
{"foo":"bar"}