@Override
    public Object deserialize(JsonParser jsonParser, DeserializationContext ctxt)
            throws IOException, JsonProcessingException {
        JsonNode replicasNode = jsonParser.readValueAsTree();
        // specNode refers to replicas
        if (replicasNode == null) {
            return defaultReplicas();
        }
        Replicas replicas = new Replicas();
        try {
            JsonNode minNode = replicasNode.get(HyscaleSpecFields.min);
            JsonNode maxNode = replicasNode.get(HyscaleSpecFields.max);
            JsonNode cpuThreshold = replicasNode.get(HyscaleSpecFields.cpuThreshold);
            
            if (maxNode != null || cpuThreshold != null) {
                // Auto scaling format
                if (minNode != null && minNode.isNumber()) {
                    replicas.setMin(Integer.valueOf(minNode.toString()));
                } else {
                    // default min
                    replicas.setMin(1);
                }
                if (maxNode != null && maxNode.isNumber()) {
                    replicas.setMax(Integer.valueOf(maxNode.toString()));
                }
                if (cpuThreshold != null && !cpuThreshold.isNull()) {
                    replicas.setCpuThreshold(cpuThreshold.asText());
                }
            } else {
                if (minNode == null) {
                    replicas.setMin(Integer.valueOf(replicasNode.toString()));
                } else {
                    replicas.setMin(Integer.valueOf(minNode.toString()));
                }
            }
        } catch (Exception e) {
            logger.error("Returning default replicas from deserializer", e);
            replicas = defaultReplicas();
        }
        return replicas;
    }
Deserializer for replicas field in the service spec.

 replicas:
     min: {min replicas}
     max: {max replicas}
     cpuThreshold: {cpuThreshold}%

     [or]

 replicas: {replica Count}
service-spec/service-spec-commons/src/main/java/io/hyscale/servicespec/commons/model/service/ReplicasDeserializer.java