Question: So I am reading data from a sensors socket which looks like

```
{
    "d": {
        "temp_mC":0,
        "humidity_ppm":28430,
        "pressure_Pa":101242,
        "temp2_mC":32937,
        "co_mV":238,
        "no2_mV":1812,
        "light_Lux":0,
        "noise_dB":79,
        "cputemp_C":34,
        "battery_mV":3155,
        "ts":"1970-01-01T00:01:08Z"
    }
}

```

Which is stored is built by a `StringBuilder sb`.

I am not very familiar with parsing JSON strings (never done it before), but I want to get the `co_mV` and `no2_mV` data. I figured I did not have to use `JSONArray` or something. So I tried this

```
 JSONObject parser = new JSONObject(sb.toString());
 System.out.println(parser.getInt("co_mV"));

```

This returns 

```
 "org.json.JSONException: No value for co_mV"

```

What am I doing wrong?

Answer: 
Original answer:

LocalDateTime in java does not accept "2014-01-01" as a valid date string.

Some additional info:

If you don't actually care what type your date is (LocalDate, OffsetDate, ZonedDate, ...), you can make it a [TemporalAccessor](https://docs.oracle.com/javase/8/docs/api/java/time/temporal/TemporalAccessor.html), then use [DateTimeFormatter::parseBest](https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#parseBest-java.lang.CharSequence-java.time.temporal.TemporalQuery...-) to parse the date.

**P.S.**  

string "2014-01-01T00:00:00" will be valid for LocalDateTime
You can simply tell the Deserializer that what comes should be a `LocalDate` even if you have a `LocalDateTime` in output, having care to have an alternative setter for your `LocalDate` *variant*.

Something as:

```java
@JsonDeserialize(as = LocalDate.class)
@Past
private LocalDateTime date;

public void setDate(LocalDateTime input) {
    date = input;
}

public void setDate(LocalDate input) {
    date = input.atStartOfDay();
}

```