Ошибка в эхо-объекте JSON в foreach Переполнение стека

Почему этот вывод кода не корректен? Я использовал этот код во многих скриптах, но получаю следующую ошибку:

Примечание. Попытка получить свойство необъекта в C: \ Users \ TPA-LAPTOP \ AppData \ Local \ Temp \ prev3 ~ .php в строке 7

Предупреждение: неверный аргумент указан для foreach () в C: \ Users \ TPA-LAPTOP \ AppData \ Local \ Temp \ prev3 ~ .php в строке 7
Примечание PHP: Попытка получить свойство необъекта в C: \ Users \ TPA-LAPTOP \ AppData \ Local \ Temp \ prev3 ~ .php в строке 7 Предупреждение PHP: В foreach () указан неверный аргумент в C: \ Users \ TPA-LAPTOP \ AppData \ Local \ Temp \ prev3 ~ .php в строке 7

<?php
$data = '{ "geocoded_waypoints" : [ { "geocoder_status" : "OK", "place_id" : "ChIJZ6jEM5S_7D8R2fAwJ8YlcZ8", "types" : [ "route" ] }, { "geocoder_status" : "OK", "place_id" : "ChIJg8uWnlMAjj8R1tzKih3Lzzc", "types" : [ "route" ] } ], "routes" : [ { "bounds" : { "northeast" : { "lat" : 35.6839107, "lng" : 51.38573599999999 }, "southwest" : { "lat" : 34.0713368, "lng" : 49.7157596 } }, "copyrights" : "Map data ©2018 Google", "legs" : [ { "distance" : { "text" : "279 km", "value" : 279413 }, "duration" : { "text" : "3 hours 7 mins", "value" : 11204 }, "end_address" : "Tehran Province, Tehran, 7th Street, Iran", "end_location" : { "lat" : 35.6825616, "lng" : 51.38573599999999 }, "start_address" : "Markazi Province, Arak, Qods Boulevard, Iran", "start_location" : { "lat" : 34.094294, "lng" : 49.7157596 }, "steps" : [ { "distance" : { "text" : "0.9 km", "value" : 947 }, "duration" : { "text" : "1 min", "value" : 89 }, "end_location" : { "lat" : 34.0988852, "lng" : 49.72428799999999 }, "html_instructions" : "Head \u003cb\u003enortheast\u003c/b\u003e on \u003cb\u003eQods Blvd\u003c/b\u003e toward \u003cb\u003eEmam Hoseyn\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003ePass by موسسه‌ خدمات حفاظتی و مراقبتی نظم گستر صدرا (on the left)\u003c/div\u003e", "polyline" : { "points" : "i`boEobmnH]cAi@}AGQ_@cAyAiEg@mAQg@EKcAqCs@uBa@aBK]kAaD[{@aB}DKUKQMQOSe@g@cA}@k@i@UWUWW[MW" }, "start_location" : { "lat" : 34.094294, "lng" : 49.7157596 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "80 m", "value" : 80 }, "duration" : { "text" : "1 min", "value" : 13 }, "end_location" : { "lat" : 34.0988768, "lng" : 49.7237912 }, "html_instructions" : "Make a \u003cb\u003eU-turn\u003c/b\u003e", "maneuver" : "uturn-left", "polyline" : { "points" : "a}boEywnnHEAMCE?E@EBCFAD?F@JBL@HDJ^\\" }, "start_location" : { "lat" : 34.0988852, "lng" : 49.72428799999999 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0.4 km", "value" : 358 }, "duration" : { "text" : "1 min", "value" : 31 }, "end_location" : { "lat" : 34.1010534, "lng" : 49.7212189 }, "html_instructions" : "Slight \u003cb\u003eright\u003c/b\u003e toward \u003cb\u003e‫‫بزرگراه شهید آنجفی‬‬‎\u003c/b\u003e", "maneuver" : "turn-slight-right", "polyline" : { "points" : "_}boEutnnHJ`@BPCNGNS\\UXc@b@eAx@cDjCwApAe@x@" }, "start_location" : { "lat" : 34.0988768, "lng" : 49.7237912 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0.4 km", "value" : 406 }, "duration" : { "text" : "1 min", "value" : 21 }, "end_location" : { "lat" : 34.1040261, "lng" : 49.7186615 }, "html_instructions" : "Slight \u003cb\u003eright\u003c/b\u003e onto \u003cb\u003e‫‫بزرگراه شهید آنجفی‬‬‎\u003c/b\u003e", "maneuver" : "turn-slight-right", "polyline" : { "points" : "qjcoEsdnnHoDlCcCrB_H|F" }, "start_location" : { "lat" : 34.1010534, "lng" : 49.7212189 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0.5 km", "value" : 520 }, "duration" : { "text" : "1 min", "value" : 48 }, "end_location" : { "lat" : 34.1083846, "lng" : 49.7194473 }, "html_instructions" : "Slight \u003cb\u003eright\u003c/b\u003e", "maneuver" : "turn-slight-right", "polyline" : { "points" : "e}coEstmnHG?I?I@s@`@GFIBKBKBK?e@AoDMsCG_@G{@EsAIWEWEIEGEGCEGMMKO_AwAGEKAGC" }, "start_location" : { "lat" : 34.1040261, "lng" : 49.7186615 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "1.8 km", "value" : 1776 }, "duration" : { "text" : "2 mins", "value" : 138 }, "end_location" : { "lat" : 34.1172737, "lng" : 49.7350356 }, "html_instructions" : "Slight \u003cb\u003eright\u003c/b\u003e onto \u003cb\u003eBolvar Keshavarz\u003c/b\u003e", "maneuver" : "turn-slight-right", "polyline" : { "points" : "kxdoEqymnHkA_CuByDS]qAeCoA_CeB_DSc@iCiFwBiEmEeIkEuGaCkEKQwDgH]m@]q@Wi@_@w@q@{Ae@iAk@mAk@kBCK[qAGYJMLUHUFW@I" }, "start_location" : { "lat" : 34.1083846, "lng" : 49.7194473 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "6.2 km", "value" : 6236 }, "duration" : { "text" : "5 mins", "value" : 317 }, "end_location" : { "lat" : 34.072538, "lng" : 49.7755983 }, "html_instructions" : "Slight \u003cb\u003eright\u003c/b\u003e onto \u003cb\u003eNorthern Hwy (Imam Ali Hwy)\u003c/b\u003e/\u003cb\u003eRoute 47\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003ePass by Central Province Police Headquarters (on the right in 3.6 km)\u003c/div\u003e", "maneuver" : "turn-slight-right", "polyline" : { "points" : "}ofoE_{pnHZ_@jCaCbEqDjLsKdGgFrRcQbLkKlAiAd@c@hEsDxGeGjEuDl@c@d@]lAoAr@u@v@s@h@i@rEgEjDwCBCxGcGdA}@f@e@FGlD_DlBcBLKhI}HzI{HFGlKcJbDoCtCkCfD_DbFmEjBaBzBmBxEgEdEwDvCiCdD{CtCkCnBkBx@u@|@w@zBkBxGgGxGcGt@o@bHkG|BuBnCgC^SVITC@?^?f@AT@TG" }, "start_location" : { "lat" : 34.1172737, "lng" : 49.7350356 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "132 km", "value" : 132287 }, "duration" : { "text" : "1 hour 25 mins", "value" : 5120 }, "end_location" : { "lat" : 34.6782574, "lng" : 50.8941868 }, "html_instructions" : "At \u003cb\u003eImam Khomeini Square\u003c/b\u003e, take the \u003cb\u003e4th\u003c/b\u003e exit onto \u003cb\u003eRoute 56\u003c/b\u003e/\u003cb\u003eAH8\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003eContinue to follow Route 56\u003c/div\u003e\u003cdiv style=\"font-size:0.9em\"\u003ePass by سامان صنعت مرکزی (on the right in 600 m)\u003c/div\u003e", "maneuver" : "roundabout-right", "polyline" : { "points" : "kx}nEoxxnHDDFJ@?JJFDF@D@D@F?R?J?RATCLEHCLIJKLMRWPYNe@^oABKV_AFq@F[BQ@SIo@Oo@IQMUQOGGMEQE[u@W]Q[I[Me@I}@IaCI{Cc@_HkDmk@wAyVcAwPm@{JiAuRaCu`@iEkt@aB_W]qF]uFgAkPC[QkDkBoZaAuP}@gN_AaQu@yJcAuN}AoVm@sNaAcQAYe@eGa@cFYoBuEit@_Eop@S}BoC{d@q@sKY}D[sESgBa@cC_@{AIe@wAmGqAkGuAkGgD{OmEyTcBuIoDiQw@_DaCwK_@aBYcBc@{CQoBkA{MQsCGw@AQQ{AWoB]qBe@mBoD_LiDuKcB_GoDaMSq@o@{BUs@Um@Oe@Oc@k@kBg@qAi@iAuAwCiDkH}EcK_CqEuD{HcEaJ_ByC{@mB{AwCa@y@MWMY{BgFqAqCmAgCYi@w@wAGKq@gAEEo@{@u@cA_AaAaA}@gCyBqZuW_I{GsW_Uk@i@kYsVeBwAkB}AaBsAuGcFuOiLaDeCg@a@g@a@SSSSc@e@c@m@k@y@g@u@S_@S_@Q_@S_@c@gAc@kA_A}C_CwHeGeSaC_IuBwGw@kC]gA_@cAU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Q?OCiA@aA?Y@oANyCNaBR_Bz@eFPu@VgAV}@t@}Bx@oBx@_BfDkG`AgB\\q@j@eAbBwCbCmE`AaBLWvCuFxBeEp@oA|F_JjAgArAiAX]l@o@h@m@To@Vq@Ps@@[@Q?EAYG}@I_@Sw@Sg@Yg@iBiB[[[YsCmC{@w@" }, "start_location" : { "lat" : 34.072538, "lng" : 49.7755983 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "127 km", "value" : 127131 }, "duration" : { "text" : "1 hour 15 mins", "value" : 4503 }, "end_location" : { "lat" : 35.6126999, "lng" : 51.3658516 }, "html_instructions" : "Keep \u003cb\u003eleft\u003c/b\u003e at the fork and merge onto \u003cb\u003ePersian Gulf Hwy\u003c/b\u003e/\u003cb\u003eRoute 7\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003ePartial toll road\u003c/div\u003e", "maneuver" : "fork-left", "polyline" : { "points" : "cbtrEugsuHyAkAwAqAkJwIy@u@w@u@WSUMWMWISGUEOAW?U@WDWJUJSJSR_@^QXOXGXI`@G\\Ed@Cd@Cj@EnEG~BGt@Kr@i@pBk@~AyFhJu@xA}ElGkBlCqDhEcCpCqCvC{B~BkCfCyBfB}BnB{B`BgCjBkA~@yBrAqEtCuGlD}HdEqDfB_D|AuBfAkLlFwJhEwHxCqAh@kIrCmNvEcHrBy@XeDdAcDbAyMfEcAZy@Tw@VkOzEqInCE@u@R}E`ByJnCuFrAaB`@gE`AcATaAP{AVyATqDh@_BRI@aBRiFj@_BP}ALiBNgBLeCN}BH_CH_ABu@@oBB}ZFcFAg@?cDBaFBoTHkBBuCF_GNuFTM?M@M@M?M@M@M?M@M@M?M@M@M?M@M?M@M@M?M@M@M?M@M@M?M@M@M?M@O@M?M@M@M?M@M@M?M@M?M@M@M@M@MBM@MBM@M@MBM@M@MBM@MBM@M@MBM@MBM@M@MBM@M@KBM@MBM@M@MBM@M@MBM@MBM@M@MBM@MBMBMBKBM@MBMBMBMBM@MBMBKBMBMBM@MBM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_EfBmAr@mB`AaCjAcD`BqBbAu@^WJc@RaClAMHUL" }, "start_location" : { "lat" : 34.6782574, "lng" : 50.8941868 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "2.2 km", "value" : 2158 }, "duration" : { "text" : "2 mins", "value" : 110 }, "end_location" : { "lat" : 35.6312923, "lng" : 51.3595602 }, "html_instructions" : "Keep \u003cb\u003eleft\u003c/b\u003e to continue on \u003cb\u003eKazemi Expy\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003ePass by the gas station (on the left in 1.3 km)\u003c/div\u003e", "maneuver" : "keep-left", "polyline" : { "points" : "krjxEqkoxHcExBmCtAmBdAaAb@aAb@uAt@g@R}@\\m@Tq@Ru@TsAXmAVsATi@FuARmALu@J{ALeFd@iDZeDVeALs@H]Dm@HYDc@He@Hc@JeDr@{Dz@gDt@cCh@u@`@qQ|D" }, "start_location" : { "lat" : 35.6126999, "lng" : 51.3658516 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0.4 km", "value" : 419 }, "duration" : { "text" : "1 min", "value" : 30 }, "end_location" : { "lat" : 35.6350103, "lng" : 51.3589043 }, "html_instructions" : "Slight \u003cb\u003eright\u003c/b\u003e at سرای عالی", "maneuver" : "turn-slight-right", "polyline" : { "points" : "qfnxEgdnxHw@?yBV]C]HmB\\m@HMBK@cCVW@wBLo@N" }, "start_location" : { "lat" : 35.6312923, "lng" : 51.3595602 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0.4 km", "value" : 380 }, "duration" : { "text" : "1 min", "value" : 32 }, "end_location" : { "lat" : 35.6381833, "lng" : 51.3597697 }, "html_instructions" : "Take the ramp to \u003cb\u003eCheraghi Expy\u003c/b\u003e", "polyline" : { "points" : "y}nxEc`nxHUBYBQ@Q?U@UC]EWG_@Me@Q_@O]KYCY?c@BoAJ]COEQC][Y_@OSOY" }, "start_location" : { "lat" : 35.6350103, "lng" : 51.3589043 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "3.1 km", "value" : 3057 }, "duration" : { "text" : "4 mins", "value" : 216 }, "end_location" : { "lat" : 35.6564958, "lng" : 51.3824297 }, "html_instructions" : "Keep \u003cb\u003eleft\u003c/b\u003e and merge onto \u003cb\u003eCheraghi Expy\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003ePass by فروشگاه Reform (on the right in 550 m)\u003c/div\u003e", "maneuver" : "keep-left", "polyline" : { "points" : "sqoxEqenxH]m@OYEKW[K]s@iBkAaDu@aBsAqDi@mA_@w@m@uASg@EGwA}BwCqDwAgBS]{@kAYe@[e@aDwDAAgAwAcAiAmAaA{@o@oAs@i@UkBu@e@OqD{@cDs@{C}@uAa@}CkA_C_BaCwBk@e@aAcAw@kAcBuCyAmDOa@oBgJIc@E_@o@uJIyAK{@WkAOg@O_@Wg@]c@UYg@[YSYS}@c@y@OmAS" }, "start_location" : { "lat" : 35.6381833, "lng" : 51.3597697 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "1.3 km", "value" : 1335 }, "duration" : { "text" : "2 mins", "value" : 102 }, "end_location" : { "lat" : 35.6684825, "lng" : 51.3816942 }, "html_instructions" : "Merge onto \u003cb\u003eNavvab Expy\u003c/b\u003e", "maneuver" : "merge", "polyline" : { "points" : "cdsxEesrxHSA_A@mA@G?sBF{CFq@BaDD_@@kFNe@@}AF}_@dAcABu@DmBFM?i@B" }, "start_location" : { "lat" : 35.6564958, "lng" : 51.3824297 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0.2 km", "value" : 241 }, "duration" : { "text" : "1 min", "value" : 30 }, "end_location" : { "lat" : 35.6706278, "lng" : 51.381785 }, "html_instructions" : "Slight \u003cb\u003eright\u003c/b\u003e", "maneuver" : "turn-slight-right", "polyline" : { "points" : "_ouxEqnrxHOMWCSEWCs@Cw@AaADuBDu@B" }, "start_location" : { "lat" : 35.6684825, "lng" : 51.3816942 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0.9 km", "value" : 912 }, "duration" : { "text" : "2 mins", "value" : 149 }, "end_location" : { "lat" : 35.6787571, "lng" : 51.3808369 }, "html_instructions" : "Continue straight", "maneuver" : "straight", "polyline" : { "points" : "m|uxEcorxHoAB}ADGBM@MBwJ`A]FiIx@}BJk@DkDP}GTWE[O" }, "start_location" : { "lat" : 35.6706278, "lng" : 51.381785 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "31 m", "value" : 31 }, "duration" : { "text" : "1 min", "value" : 11 }, "end_location" : { "lat" : 35.6787368, "lng" : 51.3811778 }, "html_instructions" : "Turn \u003cb\u003eright\u003c/b\u003e at Madar Restaurant onto \u003cb\u003eMahboub Mojaz St\u003c/b\u003e", "maneuver" : "turn-right", "polyline" : { "points" : "gowxEgirxHBcA" }, "start_location" : { "lat" : 35.6787571, "lng" : 51.3808369 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0.4 km", "value" : 350 }, "duration" : { "text" : "1 min", "value" : 82 }, "end_location" : { "lat" : 35.6818692, "lng" : 51.3808748 }, "html_instructions" : "Turn \u003cb\u003eleft\u003c/b\u003e at مؤسسه فرهنگی هنری پیشرو Pishro Institute onto \u003cb\u003eS Khoshyaran\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003ePass by Residential pear (on the left)\u003c/div\u003e", "maneuver" : "turn-left", "polyline" : { "points" : "cowxEkkrxHi@B{@HcADqA@uJf@" }, "start_location" : { "lat" : 35.6787368, "lng" : 51.3811778 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0.2 km", "value" : 159 }, "duration" : { "text" : "1 min", "value" : 37 }, "end_location" : { "lat" : 35.6820234, "lng" : 51.3826158 }, "html_instructions" : "Turn \u003cb\u003eright\u003c/b\u003e at Enqelab Cultural House Parking onto \u003cb\u003eKomeyl St\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003ePass by دفتر پیشخوان و خدمات سیم کارت برادران ملکی 72161796 (on the right)\u003c/div\u003e", "maneuver" : "turn-right", "polyline" : { "points" : "ubxxEmirxHI_@G{BAw@Ag@GaB" }, "start_location" : { "lat" : 35.6818692, "lng" : 51.3808748 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0.2 km", "value" : 230 }, "duration" : { "text" : "1 min", "value" : 58 }, "end_location" : { "lat" : 35.6839107, "lng" : 51.3826573 }, "html_instructions" : "Turn \u003cb\u003eleft\u003c/b\u003e at Hairdressers Glara toward \u003cb\u003eKashan St\u003c/b\u003e", "maneuver" : "turn-left", "polyline" : { "points" : "scxxEktrxHC@kDLgETAm@" }, "start_location" : { "lat" : 35.6820234, "lng" : 51.3826158 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "56 m", "value" : 56 }, "duration" : { "text" : "1 min", "value" : 10 }, "end_location" : { "lat" : 35.68411990000001, "lng" : 51.383132 }, "html_instructions" : "Slight \u003cb\u003eleft\u003c/b\u003e at دبیرستان نمونه دولتی دخترانه دوره اول شایسته", "maneuver" : "turn-slight-left", "polyline" : { "points" : "moxxEstrxHUKKIEKCGAIAID_@" }, "start_location" : { "lat" : 35.6839107, "lng" : 51.3826573 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0.3 km", "value" : 282 }, "duration" : { "text" : "1 min", "value" : 32 }, "end_location" : { "lat" : 35.6830855, "lng" : 51.3859814 }, "html_instructions" : "Continue straight onto \u003cb\u003eKashan St\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003ePass by کاشان (on the right)\u003c/div\u003e", "maneuver" : "straight", "polyline" : { "points" : "wpxxEqwrxHjBoH`BiG" }, "start_location" : { "lat" : 35.68411990000001, "lng" : 51.383132 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "62 m", "value" : 62 }, "duration" : { "text" : "1 min", "value" : 25 }, "end_location" : { "lat" : 35.6825616, "lng" : 51.38573599999999 }, "html_instructions" : "Turn \u003cb\u003eright\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003eDestination will be on the right\u003c/div\u003e", "maneuver" : "turn-right", "polyline" : { "points" : "ijxxEkisxHvAf@PF" }, "start_location" : { "lat" : 35.6830855, "lng" : 51.3859814 }, "travel_mode" : "DRIVING" } ], "traffic_speed_entry" : [], "via_waypoint" : [] } ], "overview_polyline" : { "points" : "i`boEobmnHeS}j@wHkHgBlIa`@lYqToEyn@ijAiG_Od@gFjaByyA|yCqmCfYeQrEyAIaNk\\aeFqZ}aFmUaoD_Iyg@qb@eaC_]{lAsq@owAelB}dBin@ui@_b@umAkvBg{Dio@_yBkUex@o[se@}qBisBqgBcgAkd@_bAuzA{}DqVwn@id@uu@uwAcqBc^sm@aRch@mLqk@ga@qy@uj@odA_q@gk@ii@ge@sb@cbAk\\qeAko@a|A_wA_jDuk@{vAcq@clAymAk}Aoz@}vAm}Aa_Cot@a|AuByk@Pqt@kCwNye@yp@wg@wh@wk@iEy]mPyVoS_i@sGw^eGqU{Hsi@_EuY{{@eWab@aYiY{Zo[eSej@sCcWkIqKsi@_ZaxAey@yYyQs`@uc@gRyd@mKkl@iDkd@aPiuB}OugA_Taw@ke@wbBok@gsBoI_Yo[gZ_Z}WkNoZoc@{z@yfAkcBwLir@wHwdB_Fwb@{IwZgMkdAoNauA}SyfAaSevAe]qfAwMgz@wKmgAkR{t@sf@cjBgM{{@wd@ulCwR{u@yZ}~Amq@ulBa[meAkOu_@{L{Uee@eS}MT{f@pReR|Did@Ti_CmEy]sHgJwHk_AioAy]_f@eSy_@aGyn@sCkeApGqYvSs_@d\\ui@_EoJ_ZgXoE_C{D~AiAdGa@xLeKtSsc@~f@mj@z]a}@|_@mv@hVwsAv]ymArDkcAbB}ZbDco@fLqvBzh@mqAzI}hAeB}x@Tqh@`EgrAdL}nAmD_YyD_q@_Ns}@cIqbB}@etAeBes@iHiaBaVqrAeGkiAlDoxCtc@_xArHgxAgC}_BkSmtAyb@s{CuoAekAyt@swA_qA_bA_qA}bAmiBmaAywBcc@a|@{O{Tos@eq@wcAuc@glBua@kn@eZc]oWm]w_@i]kk@ib@cuAuJa|@{DwqA_Gmw@uLgp@{Y}z@iYsi@g[_o@aSko@wUooBuLux@eWcz@_c@wv@m\\k_@gt@ce@eyBkq@kkAsq@gt@y^ckAaWuoAiUuv@u[cvAcy@k}@u^__AmQs|BgHicA_Mcx@uPwv@{Hq^cAi~AdFcgAyDib@wIyk@}Taa@yVg|@o_Aih@}|@of@ai@c^{Wg_Ayt@yo@odA}\\yjAiLup@aWk{@w_@uw@e{@mxAebAafD}\\on@ya@kg@_o@if@ml@kWmiAy\\mgBcL{o@~Bcw@nOurA|k@sg@tFaz@~OsOe@eGy@kDeHw]gm@}NuKm_@cOmNg\\{CgVuIiEmSZm{@tAkx@zEsSu@S}HyJG`AmKjEyE" }, "summary" : "Route 56 and Persian Gulf Hwy/Route 7", "warnings" : [], "waypoint_order" : [] } ], "status" : "OK" } ';
$arrayMessage = json_decode($data);

foreach ($arrayMessage->geocoded_waypoints as $item) {
echo $item->geocoder_status;
}
?>

-1

Решение

Ваш $data содержит искаженную строку JSON таким образом json_decode не возвращает правильный объект. Перед итерацией вы можете проверить, правильно ли была проанализирована ваша строка:

if (json_last_error()) {
die(json_last_error_msg());
}

Ваш скрипт начнет работать, как только вы исправите строку JSON. Вы можете играть с JSON_UNESCAPED_UNICODE тоже.

Ps. вы не можете просто скопировать вывод JSON из отладчика и ожидать, что это сработает, поскольку именно так вы и поступили в первую очередь, я ожидаю.

1

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]