What have you tried so far?
You can use json_decode to convert the json value to a php object or array!
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am trying to fetch reviews from Google and store it in the database. first, i need to convert them into an array.
This is my json data:
"place_id" : "ChIJ4-lzBZjH5zsRLPnqEHXuEVU", "rating" : 4.9, "reference" : "CmRRAAAAxlQ6H0h6LeQkGNQO3bc8Jx8MjpLr9E0cGAD0c0RGZ-BIJPG5de5_9fuByQpjvZs7bKcEda5rmMfKfoK2VwVoJ7Pt6-4B2VNZeHB-YAp55-ZfzxA2-B69zNgP8911xIueEhDrRdKGoy1zlZjE8zXql-B8GhRP3g-cmb0YJUhF2PbYOvWc6_aYzQ", "reviews" : [ { "author_name" : "Adwait Pawaskar", "author_url" : "https://www.google.com/maps/contrib/113999417105639528965/reviews", "language" : "en", "profile_photo_url" : "https://lh5.googleusercontent.com/-woxcZ-kNOB8/AAAAAAAAAAI/AAAAAAAAAAA/AA6ZPT5CAmELoJsYT2S0C-jy0CW77la-iw/s128-c0x00000000-cc-rp-mo/photo.jpg", "rating" : 5, "relative_time_description" : "6 months ago", "text" : "101 musicals academy is a Great Class with a passionate and hardworking teacher , who knows what he is doing , always helps students , lets us learn in our own way and guides in the right direction whenever necessary. I enjoy learning music with Mithilesh", "time" : 1500523348 },
What have you tried so far?
You can use json_decode to convert the json value to a php object or array!
Please or to participate in this conversation.