#!/usr/bin/perl use strict; use warnings; use Config::Tiny; use JSON::PP; my $config_file = 'test.ini'; my $config_obj = Config::Tiny->new; my $config = $config_obj->read( $config_file ); my $json_obj = JSON::PP->new; my %hash = %{$config}; print $json_obj->encode( \%hash );