It's valid Json, does it display correctly in an app, not browser's network console.
See https://jsonlint.com/ a reference @Cronix shared in another post.
It shows valid.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi everybody,
I my API Resource I am accessing $user->options, which is a JSON field:
Schema::table('users', function (Blueprint $table) {
$table->json('options');
});
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\Gate;
class UserResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
*
* @return array
*/
public function toArray($request)
{
return [
'id' => $this->id,
'options' => $this->options,
];
}
}
Now my result (seen on my browser's network console) is this:
options: "{\"notify_on_mail\":true}"
How can I return this unquoted?
The problem: I can not access this in Vue.js:
undefined is not an object (evaluating '_vm.user.options.notify_on_mail')
Your help is highly appreciated :-)
Please or to participate in this conversation.