Answer the question
In order to leave comments, you need to log in
How to pass boolean to json instead of int?
How to pass boolean to json instead of int?
First, I load the data from the database:
$rows = DB::select($sql);
Next, I process the array, push the necessary rows into the array, which will be sent as json:
if ($row['pid'] == $request->get('id')) {
$arr = array(
'id' => $row['id'],
'parent' => $row['pid'],
'text' => $row['shortname'],
'children' => true,
);
array_push($json, $arr);
}
return response()->json($json);
return response(json_encode($json), 200)->header('Content-Type', 'application/json');
json_encode(): Invalid UTF-8 sequence in argument
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question