feat: add Liquid filters 'parse_json'

This commit is contained in:
Benjamin Nussbaum 2025-08-27 21:31:21 +02:00
parent f38ac778f1
commit 9d1f62c6dd
2 changed files with 59 additions and 0 deletions

View file

@ -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);
}
}