code: @Override
      public Collection<Monitor> deserialize(JsonElement element, Type type, JsonDeserializationContext context)
          throws JsonParseException
      {
          JsonObject obj = element.getAsJsonObject();
          JsonArray monitors = obj.getAsJsonArray("monitors");
          List<Monitor> values = new ArrayList<Monitor>();
          if(monitors != null && monitors.isJsonArray())
          {
              for(JsonElement monitor : monitors)
              {
                  if(monitor.isJsonObject())
                  {
                      JsonElement monitorType = monitor.getAsJsonObject().get("type");
                      if(monitorType != null)
                      {
                          switch(Monitor.MonitorType.valueOf(monitorType.getAsString()))
                          {
                              case SIMPLE:
                                  values.add(gson.fromJson(monitor, SimpleMonitor.class));
                                  break;
                              case BROWSER:
                                  values.add(gson.fromJson(monitor, BrowserMonitor.class));
                                  break;
                              case SCRIPT_BROWSER:
                                  values.add(gson.fromJson(monitor, ScriptBrowserMonitor.class));
                                  break;
                              case SCRIPT_API:
                                  values.add(gson.fromJson(monitor, ScriptApiMonitor.class));
                                  break;
                          }
                      }
                  }
              }
          }
          return values;
      }
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 monitors