You are here

public static function TwigConvert::jsonDecode in Twig Tools 8

Decodes a JSON string into an object or array.

Parameters

string $value: The JSON string to decode.

bool $assoc: If TRUE, will convert JSON to an associative array instead of an object.

Return value

array|object The object or array equivalent of the JSON string.

File

src/TwigExtension/TwigConvert.php, line 108

Class

TwigConvert
Class TwigConvert.

Namespace

Drupal\twig_tools\TwigExtension

Code

public static function jsonDecode($value, $assoc = FALSE) {
  return json_decode($value, $assoc);
}