my $json = encode_json(\@rawRecords); #### my $typehint_person = { lastname => JSON_TYPE_STRING, firstname => JSON_TYPE_STRING, age => JSON_TYPE_INT}; my $typehint_persons = [ ($typehint_person) x @rawRecords ]; my $json = encode_json(\@rawRecords, $typehint_persons);