title: Converting perl Data Dumper Format into JSON
body: <p>I have Dumper outputting data correctly:</p>
  
  <pre><code>      'Apps' =&gt; [
                              \{
                                  'name' =&gt; '1'
                                },
                              \{
                                  'name' =&gt; '2'
                                },
                              \{
                                  'name' =&gt; '3'
                                },
                              \{
                                  'name' =&gt; '4'
                                },
                              \{
                                  'name' =&gt; '5'
                                },
                              \{
                                  'name' =&gt; '6'
                                },
                              \{
                                  'name' =&gt; '7'
                                }
                            ],
        'code' =&gt; 'SUCCESS'
      };
  </code></pre>
  
  <p>But when I convert it to JSON I have a lot of problems:</p>
  
  <pre><code>  my @jsonapps;
    my @apps = map { $_ } keys %glob;
    my %hash;
    $hash{'code'} = 'SUCCESS';
  
    for (@apps) {
       my $app = { 'name' =&gt; $_ };
       push (@jsonapps, \$app);
    }
  
   # $hash{'Apps'} = \@jsonapps;
  
    my $jsonfinal = encode_json \%hash;
    print $jsonfinal;
  </code></pre>
  
  <p>It definitely has to do when with I try to add an array of hashes in:</p>
  
  <pre><code>$hash{'Apps'} = \@jsonapps;
  </code></pre>
  
  <p>But I'm having a problem doing that since all the hashes have the same key "name". I need my output to look like:</p>
  
  <pre><code>{"code":"SUCCESS","Apps":[{"name":"1"},{"name":"2"},{"name":"3"},{"name":"4"},{"name":"5"},{"name":"6"},{"name":"7"}]}
  </code></pre>
  
  <p>Thanks, I appreciate the help - I've scoured everywhere to figure out how to do this, and I'm just banging my head against the wall now. Thanks!</p>