0

I'm trying to pull just the [name] from the following JSON and print it on a webpage.

JSON:

[uploads] => Array
    (
        [0] => Array
            (
                [id] => 153270
                [name] => heartbt.wav
                [basename] => heartbt
                [ext] => wav
                [size] => 37742
                [mime] => audio/x-wav
                [type] => audio
                [field] => my_file
                [md5hash] => 947aff5e7fc7f19caff9032125e42a12
                [original_id] => 153270
                [original_basename] => heartbt
                [original_path] => /
                [original_md5hash] => 947aff5e7fc7f19caff9032125e42a12
                [from_batch_import] => 
                [url] => http://tmp.tr.com.s3.amazonaws.com/153c5c701f4511e5876dcf9427be7270.wav
                [ssl_url] => https://s3.amazonaws.com/tmp.tr.com/153c5c701f4511e5876dcf9427be7270.wav
                [meta] => Array
                    (
                        [duration] => 3.42
                        [audio_bitrate] => 88200
                        [overall_bitrate] => 88311
                        [audio_samplerate] => 11025
                        [audio_channels] => 1
                        [audio_codec] => pcm
                        [encoder] => 
                        [beats_per_minute] => 
                        [album] => 
                        [year] => 
                        [genre] => 
                        [artist] => 
                        [comment] => 
                        [performer] => 
                        [lyrics] => 
                        [title] => 
                        [band] => 
                        [disc] => 
                        [track] => 
                    )

            )

    )

My code:

$array = json_decode($result, true);
print_r($array["result"]["name"][0]);

If I use the following it shows the full JSON output so I know it's seeing the JSON.

print_r(json_decode($result, true));

Any ideas? I've been going over everything I can find here about json_decode with no luck.

P.S. I'm an old perl programmer so this json has me a little confused... Anyone remember Matt's Script Archive? :)

0 Answers0