2 dimensional JSON array

pipasha posted 1 year ago

I want to create 2 dimensional JSON array from database. The format will be as followings [ {"id":"856","name":"House"}, {"id":"1035","name":"Desperate Housewives"}, ... ]

Can anybody kindly give any idea?

saurabhd replied 1 year ago

For creating 2 dimensional json array, follow below example code:

$fetch = DB::table('table_name')->get();


Hope, this work for you.

Sign in to participate in this thread!

We'd like to thank these amazing companies for supporting us