Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Help with JSON

  1. #1
    New to the CF scene
    Join Date
    Feb 2015
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Help with JSON

    Hi all!
    I need help with a JSON parsing issue.

    My JSON file:
    https://www.dropbox.com/s/360ygwzvy2e17xh/comments.json

    My PHP file:
    <?php
    $json_file = get_data('comments.json');
    $jfo = json_decode($json_file);
    $entradas = $jfo->feed->entry;
    foreach ($entradas as $entrada) {
    echo "<br>".$entradas->author->name->{'$t'};
    echo "<br>".$entrada->content->{'$t'};
    echo "<br>".$entrada->published->{'$t'};
    }
    ?>

    Everything works well, except the first line after for each:

    echo $entradas->author->name->{'$t'};

    Someone could help me to fix this?

    Thanks in advance.

  • #2
    New to the CF scene
    Join Date
    Feb 2015
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Fixed!

    echo "<br>".$entrada->author[0]->name->{'$t'};

    Best Regards.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •