code: @Override
      public Monitor deserialize(JsonElement element, Type type, JsonDeserializationContext context)
          throws JsonParseException
      {
          JsonObject obj = element.getAsJsonObject();
          JsonElement monitorType = obj.get("type");
          if(monitorType != null)
          {
              switch(Monitor.MonitorType.valueOf(monitorType.getAsString()))
              {
                  case SIMPLE:
                      return gson.fromJson(obj, SimpleMonitor.class);
                  case BROWSER:
                      return gson.fromJson(obj, BrowserMonitor.class);
                  case SCRIPT_BROWSER:
                      return gson.fromJson(obj, ScriptBrowserMonitor.class);
                  case SCRIPT_API:
                      return gson.fromJson(obj, ScriptApiMonitor.class);
              }
          }
          return null;
      }
docs: Gson invokes this call-back method during deserialization when it encounters a field of the specified type.
  @param element The Json data being deserialized
  @param type The type of the Object to deserialize to
  @param context The JSON deserialization context
  @return The monitor