๐:0
You could create an array with key โdataโ and another array as the value;
$myArray = ["data" => [1, 2, 3]];
echo json_encode($myArray);
Output
{"data":[1,2,3]}
Or put the values between quotes
$myArray = ["data" => ["1", "2", "3"]];
Output
{"data":["1","2","3"]}
๐:-1
Not sure completely understood the problem. But if you want to convert values of php array to a json you can do something like that:
json_encode(array_values($myArray));