Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser load list in hash value no matter the indentation. #58

Open
dod38fr opened this issue Oct 1, 2021 · 0 comments
Open

Parser load list in hash value no matter the indentation. #58

dod38fr opened this issue Oct 1, 2021 · 0 comments

Comments

@dod38fr
Copy link

dod38fr commented Oct 1, 2021

Hi

YAML::Tiny does not parse correctly this YAML:

- foo:
   bar: 
- foo2:
   bar2: {}

It should produce this:

$ perl -MYAML::PP -MData::Dumper -E 'my $data = YAML::PP::LoadFile("test.yml"); say Dumper($data);'
$VAR1 = [
          {
            'foo' => {
                       'bar' => undef
                     }
          },
          {
            'foo2' => {
                        'bar2' => {}
                      }
          }
        ];

But YAML::Tiny store foo2 item in bar value instead of leaving bar undef:

 perl -MYAML::Tiny -MData::Dumper -E 'my $data = YAML::Tiny->read("test.yml"); say Dumper($data);'
$VAR1 = bless( [
                 [
                   {
                     'foo' => {
                                'bar' => [
                                           {
                                             'foo2' => {
                                                         'bar2' => {}
                                                       }
                                           }
                                         ]
                              }
                   }
                 ]
               ], 'YAML::Tiny' );

This was tested on Debian/unstable with:

  • YAML::Tiny 1.73
  • perl 5.32.1

All the best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant