Make sure the variable is a string type before using string comparing function

Because sometime JSON data may be a multi dimension array as following:
array(
  "a": []
) 
In this case, this express will cause 2 PHP warning.