TODO: remove gson support here
964683
public List<String> getProperties(String json) {
        List<String> properties = new ArrayList<>();
        JsonObject jsonObject = new JsonParser().parse(json).getAsJsonObject();
        for (Map.Entry<String, JsonElement> property : jsonObject.entrySet()) {
            properties.add(property.getKey());
        }
        return properties;
    }
252903
@GwtIncompatible("Unnecessary")
  private boolean isOutputInJson() {
    return config.jsonStreamMode == JsonStreamMode.OUT
        || config.jsonStreamMode == JsonStreamMode.BOTH;
  }
892318
private Gson getGson()
    {
        if (gson == null)
        {
            GsonBuilder builder = new GsonBuilder();

            builder.registerTypeAdapter(ErrorResponse.class, new ErrorResponseDeserializer());
            builder.registerTypeAdapter(AlertPolicy.class, new AlertPolicySerializer());
            builder.registerTypeAdapter(AlertPolicy.class, new AlertPolicyDeserializer());
            builder.registerTypeAdapter(ALERT_POLICIES_TYPE, new AlertPoliciesDeserializer());
            builder.registerTypeHierarchyAdapter(AlertChannel.class, new AlertChannelSerializer());
            builder.registerTypeAdapter(ALERT_CHANNELS_TYPE, new AlertChannelsDeserializer());
            builder.registerTypeAdapter(AlertPolicyChannel.class, new AlertPolicyChannelDeserializer());
            builder.registerTypeHierarchyAdapter(AlertCondition.class, new AlertConditionSerializer());
            builder.registerTypeAdapter(AlertCondition.class, new AlertConditionDeserializer());
            builder.registerTypeAdapter(ALERT_CONDITIONS_TYPE, new AlertConditionsDeserializer());
            builder.registerTypeAdapter(NrqlAlertCondition.class, new NrqlAlertConditionSerializer());
            builder.registerTypeAdapter(NrqlAlertCondition.class, new NrqlAlertConditionDeserializer());
            builder.registerTypeAdapter(NRQL_ALERT_CONDITIONS_TYPE, new NrqlAlertConditionsDeserializer());
            builder.registerTypeHierarchyAdapter(ExternalServiceAlertCondition.class, new ExternalServiceAlertConditionSerializer());
            builder.registerTypeAdapter(ExternalServiceAlertCondition.class, new ExternalServiceAlertConditionDeserializer());
            builder.registerTypeAdapter(EXTERNAL_SERVICE_ALERT_CONDITIONS_TYPE, new ExternalServiceAlertConditionsDeserializer());
            builder.registerTypeHierarchyAdapter(PluginsAlertCondition.class, new PluginsAlertConditionSerializer());
            builder.registerTypeAdapter(PluginsAlertCondition.class, new PluginsAlertConditionDeserializer());
            builder.registerTypeAdapter(PLUGINS_ALERT_CONDITIONS_TYPE, new PluginsAlertConditionsDeserializer());
            builder.registerTypeHierarchyAdapter(SyntheticsAlertCondition.class, new SyntheticsAlertConditionSerializer());
            builder.registerTypeAdapter(SyntheticsAlertCondition.class, new SyntheticsAlertConditionDeserializer());
            builder.registerTypeAdapter(SYNTHETICS_ALERT_CONDITIONS_TYPE, new SyntheticsAlertConditionsDeserializer());
            builder.registerTypeHierarchyAdapter(InfraAlertCondition.class, new InfraAlertConditionSerializer());
            builder.registerTypeAdapter(InfraAlertCondition.class, new InfraAlertConditionDeserializer());
            builder.registerTypeAdapter(INFRA_ALERT_CONDITIONS_TYPE, new InfraAlertConditionsDeserializer());
            builder.registerTypeAdapter(ALERT_INCIDENTS_TYPE, new AlertIncidentsDeserializer());
            builder.registerTypeAdapter(ALERT_VIOLATIONS_TYPE, new AlertViolationsDeserializer());
            builder.registerTypeAdapter(ALERT_EVENTS_TYPE, new AlertEventsDeserializer());
            builder.registerTypeAdapter(Application.class, new ApplicationSerializer());
            builder.registerTypeAdapter(Application.class, new ApplicationDeserializer());
            builder.registerTypeAdapter(APPLICATIONS_TYPE, new ApplicationsDeserializer());
            builder.registerTypeAdapter(ApplicationHost.class, new ApplicationHostDeserializer());
            builder.registerTypeAdapter(APPLICATION_HOSTS_TYPE, new ApplicationHostsDeserializer());
            builder.registerTypeAdapter(ApplicationInstance.class, new ApplicationInstanceDeserializer());
            builder.registerTypeAdapter(APPLICATION_INSTANCES_TYPE, new ApplicationInstancesDeserializer());
            builder.registerTypeAdapter(BrowserApplication.class, new BrowserApplicationSerializer());
            builder.registerTypeAdapter(BrowserApplication.class, new BrowserApplicationDeserializer());
            builder.registerTypeAdapter(BROWSER_APPLICATIONS_TYPE, new BrowserApplicationsDeserializer());
            builder.registerTypeAdapter(MobileApplication.class, new MobileApplicationDeserializer());
            builder.registerTypeAdapter(MOBILE_APPLICATIONS_TYPE, new MobileApplicationsDeserializer());
            builder.registerTypeAdapter(KeyTransaction.class, new KeyTransactionDeserializer());
            builder.registerTypeAdapter(KEY_TRANSACTIONS_TYPE, new KeyTransactionsDeserializer());
            builder.registerTypeAdapter(Plugin.class, new PluginDeserializer());
            builder.registerTypeAdapter(PLUGINS_TYPE, new PluginsDeserializer());
            builder.registerTypeAdapter(PluginComponent.class, new PluginComponentDeserializer());
            builder.registerTypeAdapter(PLUGIN_COMPONENTS_TYPE, new PluginComponentsDeserializer());
            builder.registerTypeAdapter(Server.class, new ServerSerializer());
            builder.registerTypeAdapter(Server.class, new ServerDeserializer());
            builder.registerTypeAdapter(SERVERS_TYPE, new ServersDeserializer());
            builder.registerTypeAdapter(METRICS_TYPE, new MetricsDeserializer());
            builder.registerTypeAdapter(MetricData.class, new MetricDataDeserializer());
            builder.registerTypeAdapter(Deployment.class, new DeploymentSerializer());
            builder.registerTypeAdapter(Deployment.class, new DeploymentDeserializer());
            builder.registerTypeAdapter(DEPLOYMENTS_TYPE, new DeploymentsDeserializer());
            builder.registerTypeAdapter(Label.class, new LabelSerializer());
            builder.registerTypeAdapter(Label.class, new LabelDeserializer());
            builder.registerTypeAdapter(LABELS_TYPE, new LabelsDeserializer());
            builder.registerTypeAdapter(User.class, new UserDeserializer());
            builder.registerTypeAdapter(USERS_TYPE, new UsersDeserializer());
            builder.registerTypeAdapter(UsageData.class, new UsageDataDeserializer());
            builder.registerTypeAdapter(PARTNER_ACCOUNTS_TYPE, new PartnerAccountsDeserializer());
            builder.registerTypeAdapter(PartnerUser.class, new PartnerUserSerializer());
            builder.registerTypeAdapter(PARTNER_USERS_TYPE, new PartnerUsersDeserializer());
            builder.registerTypeAdapter(PARTNER_SUBSCRIPTIONS_TYPE, new PartnerSubscriptionsDeserializer());
            builder.registerTypeAdapter(PRODUCT_SUBSCRIPTIONS_TYPE, new ProductSubscriptionsSerializer());
            builder.registerTypeAdapter(Monitor.class, new MonitorDeserializer());
            builder.registerTypeAdapter(MONITORS_TYPE, new MonitorsDeserializer());
            builder.registerTypeAdapter(Dashboard.class, new DashboardSerializer());
            builder.registerTypeAdapter(Dashboard.class, new DashboardDeserializer());
            builder.registerTypeAdapter(DASHBOARDS_TYPE, new DashboardsDeserializer());

            gson = builder.create();
        }

        return gson;
    }
28927
public static String serialise(Object object) {
        Gson gson = getBuilder().create();
        return gson.toJson(object);
    }
227042
public void put(String key, Object object, boolean serialize){
        if(serialize)
            put(key,gson.toJson(object));
        else
            put(key,object);
    }
110962
@SuppressWarnings("unused")
  public static CarmenContext fromJson(@NonNull String json) {
    Gson gson = new GsonBuilder()
      .registerTypeAdapterFactory(GeocodingAdapterFactory.create())
      .create();
    return gson.fromJson(json, CarmenContext.class);
  }
698515
public static <T> T decode(String json, Class<T> cls) {
        return GSON.fromJson(json, cls);
    }
402869
public JsonReader newJsonReader( String input ) {
        JsonReader reader = new NonBufferedJsonReader( input );
        reader.setLenient( true );
        return reader;
    }
1234595
@Override
  public String toJson() {

    GsonBuilder gson = new GsonBuilder();
    gson.registerTypeAdapterFactory(GeoJsonAdapterFactory.create());
    gson.registerTypeAdapterFactory(GeometryAdapterFactory.create());
    return gson.create().toJson(this);
  }
46832
@Nullable
    public static <T> T getJson(@NonNull SharedPreferences prefs,
            @NonNull String key, @NonNull Type type) {
        return GsonHelper.fromJson(prefs.getString(key, null), type);
    }
867945
@JsonValue
	public Object toJsonValue() {
		if (flags != null)
			return flags;
		if (mode != null)
			return mode;
		return null;
	}
43975
private static Optional<ICondition> asNotLessThan( JsonObject json)
    {
    return
      Optional.of( json)
      .filter( j -> j.containsKey( NOT_LESS_THAN_KEY))
      .map( j -> j.getJsonObject( NOT_LESS_THAN_KEY))
      .map( a -> new AssertNotLess( a.getString( PROPERTY_KEY), a.getInt( MIN_KEY)));
    }
482096
public static <T> T fromJson(String json, Class<T> klass)
    {
        return GSON.fromJson(json, klass);
    }
681950
@Override
    public String toJSONString() {
        Gson gson = new GsonBuilder()
                .excludeFieldsWithoutExposeAnnotation()
                //.registerTypeAdapter(Date.class, new DateSerializer())
                //.setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
                .create();
        return gson.toJson(this);
    }
881700
public static BaseBo fromJson(String json, ClassLoader classLoader) {
        return fromJson(json, BaseBo.class, classLoader);
    }
348204
public static <O> O deserialise(String json, Class<O> type) {
        Gson gson = getBuilder().create();
        return gson.fromJson(json, type);
    }
1180793
function unmarshalBuffer(json) {
  _.forEach(json, function(value, key) {
    // Null check to prevent creation of Buffer when value is null
    if (value !== null && value.type==="Buffer") {
      json[key]= new Buffer(value.data);
    }
  });
  return json;
}