How do I read this json data and display in table in php Laravel?
[{"name":"G_edited"},{"name":"G_update"}]
How do I read this json data and display in table in php Laravel?
[{"name":"G_edited"},{"name":"G_update"}]
You just need to use json_decode()
to get the desired results. Then use foreach
to print in in a table. Consider this example:
<?php
$raw_json = '[{"name":"G_edited"},{"name":"G_update"}]';
$data = json_decode($raw_json, true);
?>
<table border="1" cellpadding="10">
<tr><th>Name</th></tr>
<?php foreach($data as $key => $value): ?>
<tr><td><?php echo $value['name']; ?></td></tr>
<?php endforeach; ?>
</table>