mercredi 25 octobre 2017

Laravel structuring JSON response

I am struggling to structure json response in Laravel, here's an example:

{
  "0": {
    "instagram": [
      {
        "description": "#trainedacademy taking a break. We will resume for business on Monday 😎 @nickyjanew 🌞",
        "time": "Wednesday 25th October",
        "image": "http://ift.tt/2y7rqcq",
        "likes": 15,
        "comments": 0,
        "link": "http://ift.tt/2yOhWWY",
        "video": "http://ift.tt/2y7F5Al"
      },
      {
        "description": "Jump into a #personaltraining #career! Started college and decided it’s not for you? Want to be a Gym Instructor? Circuit Trainer? Or work towards a career in the Fire Service? Join us Weds night for open enrolment or just get some careers advice from @paulalitherland and @nickyjanew \n@mahdloyouthzone 6:30pm Wednesday 8th November 2017. \nUCAS accredited \nindustry recognised \nExclusive discounts with the Fire Team badge \nFree food box @chiaproteinbar \nWork placements @thegymgroup",
        "time": "Sunday 8th October",
        "image": "http://ift.tt/2yOyTkb",
        "likes": 42,
        "comments": 2,
        "link": "http://ift.tt/2y7F4wh",
        "video": "http://ift.tt/2y7F5Al"
      },
      {
        "description": "#trainedacademy #team @mahdloyouthzone preparing marketing material for 2018 enrolments. #oldhamfitness #oldham #practical #learningenhanced #alevels #employability @gymcareer @thegymgroup @chiaproteinbar",
        "time": "Friday 6th October",
        "image": "http://ift.tt/2yO6kTP",
        "likes": 50,
        "comments": 0,
        "link": "http://ift.tt/2y7FIcO",
        "video": "http://ift.tt/2y7F5Al"
      },

What I want to do is get rid of the "0": { part of the json. Is that possible?

    return response()->json(['count' => $count_instagram, ['instagram' => $instagramArray ]], 200);



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2yO6lXT
via IFTTT

Aucun commentaire:

Enregistrer un commentaire