Handle JSON strings when getting directive name