mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-14 15:37:53 +00:00
feat: add Liquid filters 'parse_json'
This commit is contained in:
parent
f38ac778f1
commit
9d1f62c6dd
2 changed files with 59 additions and 0 deletions
|
|
@ -78,4 +78,15 @@ class Data extends FiltersProvider
|
|||
|
||||
return $array[array_rand($array)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a JSON string into a PHP value
|
||||
*
|
||||
* @param string $json The JSON string to parse
|
||||
* @return mixed The parsed JSON value
|
||||
*/
|
||||
public function parse_json(string $json): mixed
|
||||
{
|
||||
return json_decode($json, true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue