in reply to Re^3: Push values into a hash
in thread Push values into a hash

Hi, I posted a better sample code to show it better. I would like to end up with json data as:
["name:Joe","address:Main Street","phone: 346 20274","email:test1@test +.com"] ...

thanks!

Replies are listed 'Best First'.
Re^5: Push values into a hash
by Corion (Patriarch) on Jul 25, 2016 at 16:11 UTC

    Then maybe a first step would be to create the strings:

    "name:Joe"

    This is somewhat weird, because JSON usually doesn't encode information in tagged strings but as "objects" (anonymous hashes in Perl).

    Maybe you can show us an example of your data structure where you have two persons, Joe and Jane?

    Usually, with JSON, you don't build the string but build the appropriate Perl data structure and export that data strucutre as JSON using one of the modules. But until you show us what the data structure should look like, we can't really help you building it.