0
私はLaravelでJSONレスポンスを構築するために苦労しています、ここでの例です:{JSONの一部:Laravel構造化JSONレスポンス
{
"0": {
"instagram": [
{
"description": "#trainedacademy taking a break. We will resume for business on Monday @nickyjanew ",
"time": "Wednesday 25th October",
"image": "https://scontent-lhr3-1.cdninstagram.com/t51.2885-15/s640x640/e15/22794071_716881718510905_8530561994892247040_n.jpg",
"likes": 15,
"comments": 0,
"link": "https://www.instagram.com/p/Baq437_FRav/",
"video": "https://scontent-lhr3-1.cdninstagram.com/t50.2886-16/22831768_291580031330276_8396013842173263872_n.mp4"
},
{
"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 \[email protected] 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": "https://scontent-lhr3-1.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/22277977_106714113419553_5412239854790508544_n.jpg",
"likes": 42,
"comments": 2,
"link": "https://www.instagram.com/p/BZ-WYZJloMY/",
"video": "https://scontent-lhr3-1.cdninstagram.com/t50.2886-16/22831768_291580031330276_8396013842173263872_n.mp4"
},
{
"description": "#trainedacademy #team @mahdloyouthzone preparing marketing material for 2018 enrolments. #oldhamfitness #oldham #practical #learningenhanced #alevels #employability @gymcareer @thegymgroup @chiaproteinbar",
"time": "Friday 6th October",
"image": "https://scontent-lhr3-1.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/22280199_2265489343466713_511544494877835264_n.jpg",
"likes": 50,
"comments": 0,
"link": "https://www.instagram.com/p/BZ5hLU6FRzr/",
"video": "https://scontent-lhr3-1.cdninstagram.com/t50.2886-16/22831768_291580031330276_8396013842173263872_n.mp4"
},
は、私は何をしたい「0」を取り除くことです。それは可能ですか?
return response()->json(['count' => $count_instagram, ['instagram' => $instagramArray ]], 200);
'周りの括弧を取り除く[ 'Instagramの' => $ instagramArray]'。それはサブアレイとしてキャストしています。 – aynber
@aynberあなたは答えとして投稿する必要があります... – ljubadr