In the form, I use Javascript's JSON.stringify() to create a string like:
# spaces added for readability
$json = qq~
[
null,
{"0":{},"length":1},
{"0":{},"length":1},
{"name":"20221020_164047.jpg","uuid":"43f07ec4-17a7-4874-bb84-66a0f002f48e"},
{"name":"20221021_144704 (1).jpg","uuid":"71bba099-2616-4415-b420-0d0d16c19c30"}
]
~;
I'm not sure why it gets wrapped in [ ], I guess JSON.stringify() does that? But it's not intentional on my part. I'm also not sure why I get "null" or {"0":{},"length":1} in there, all that I'm intentionally plugging in are the two lines with "name" and "uuid".
I installed the JSON module, and
$text = decode_json $json; print Dumper($text); gives me:
$VAR1 = [
undef,
{
'length' => 1,
'0' => {}
},
{
'length' => 1,
'0' => {}
},
{
'name' => '20221020_164047.jpg',
'uuid' => '43f07ec4-17a7-4874-bb84-66a0f002f48e'
},
{
'name' => '20221021_144704 (1).jpg',
'uuid' => '71bba099-2616-4415-b420-0d0d16c19c30'
}
];
From there, how do I access each name and uuid?