Reputation: 1476
I store json in my db and retrive it in decoded format using my model. I pass the value to a blade and tries to display a value from json there.
I dd($properties)
and gets this:
array:1 [
"like" => 10
]
This works: {{dd($properties["like"])}}
gets correct integer value 10
But when I do {{$properties["like"]}}
it returns "Cannot access offset of type string on string"
.
But $properties
is not a string, coz when I {{$properties}}
, it gives "htmlspecialchars(): Argument #1 ($string) must be of type string, array given"
. {{gettype($properties)}}
gives array
.
Upvotes: 0
Views: 158
Reputation: 88
use for loop
foreach($properties as $property) {
$property["like"];
}
Upvotes: 1