You are here

private function LazyForm::isJson in Lazy-load 8.3

Check if the provided string is a valid JSON object.

Parameters

string $string: JSON data as string.

Return value

bool Returns true if string is a valid JSON, false otherwise.

1 call to LazyForm::isJson()
LazyForm::validateForm in src/Form/LazyForm.php
Form validation handler.

File

src/Form/LazyForm.php, line 546

Class

LazyForm
Configure Lazy settings for this site.

Namespace

Drupal\lazy\Form

Code

private function isJson($string) : bool {
  json_decode($string, FALSE);
  return json_last_error() == JSON_ERROR_NONE;
}