Use fromJson instead of JSON.parse for primitive values and check for atob