Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tayyabshahzad1's avatar

API Response

Hi, I have made a take order API and that is a POST API now android developer add data into the API form, and that data is coming into my controller when I return the whole $request the response is below. Please guide me on how can I add Loop and other operations on that particular order detail to store my order in my DB The response is

{"data":"{franchise_id: 1, products: [{id: 1, quantity: 4, extras: [2], modifier: [{id: 2, items: [4]}, {id: 1, items: [4, 5]}]}, {id: 2, quantity: 6, extras: [1, 2], modifier: [{id: 2, items: [5]}]}, {id: 3, quantity: 2, extras: [3], modifier: []}], is_pickup: true, user_id: 1, sub_total: 30000.0, total: 30000.0}"}

0 likes
4 replies
tayyabshahzad1's avatar

@jlrdw Thanks for your reply but in my case i am unable to get data for example i want my franchise_id for that if i use $request->franchise_id it is returning me null

tayyabshahzad1's avatar
tayyabshahzad1
OP
Best Answer
Level 2

I get the solution actually the data is not JSON this is string data.

Please or to participate in this conversation.