mardi 25 février 2020

How would I decode this JSON to insert into a json column? ErrorException: Object of class stdClass could not be converted to string in file

What would be the proper way to decode this json?

my model has

 protected $casts = [
        'items' => 'array'
    ];

my json items:

{
    "data": [
    {
        "name": "Google",
        "link": "http://google.com"
    }, 
    {
        "name": "ALink",
        "link": "http://link.org"
    }
  ]
}

json_decode($request->items) returns the error: ErrorException: Object of class stdClass could not be converted to string in file



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire