My question is that what is correct way to return table rows as a json from php file to ajax for more manipulation, I have done the process of fetching one row and pushing into another main array and returning that with json_encode.
I am using php 7. If I use this MySQL query like this:
$result = $connection->query($sql)
will it return Json array and can I manipulate it in JavaScript? Is this is the correct way?
**Update**: Now I am running php version 8.