Json::encode

public static Json::encode($variable)

Uses HTML-safe strings, with several characters escaped.

Overrides SerializationInterface::encode

File

core/lib/Drupal/Component/Serialization/Json.php, line 17

Class

Json
Default serialization for JSON.

Namespace

Drupal\Component\Serialization

Code

public static function encode($variable) {
  // Encode <, >, ', &, and ".
  return json_encode($variable, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);
}
doc_Drupal
2016-10-29 09:21:36
Comments
Leave a Comment

Please login to continue.