# JSON serialization differences from HLRC to new Java API Client

**URL:** <https://discuss.elastic.co/t/json-serialization-differences-from-hlrc-to-new-java-api-client/340651>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [August 11, 2023, 3:52pm UTC](https://discuss.elastic.co/t/json-serialization-differences-from-hlrc-to-new-java-api-client/340651 "2023-08-11T15:52:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![toddcarv](https://avatars.discourse-cdn.com/v4/letter/t/779978/32.png) [@toddcarv](https://discuss.elastic.co/u/toddcarv)\
**Post date:** [August 11, 2023, 3:52pm UTC](https://discuss.elastic.co/t/json-serialization-differences-from-hlrc-to-new-java-api-client/340651/1 "2023-08-11T15:52:55Z")

</div>

With the HLRC, the timestamp field below is serialized as "2023-08-10T18:59:59.143Z". However, with the new Java API Client it is serialized as a long time. This is with the new BulkIngester. Is there a way to customize the serialization to write the date as a string and include the time zone as previously? Thanks.

```auto
Map<String,Object> data = new HashMap<>();
data.put("timestamp", new Date());
IndexRequest request = new IndexRequest(index);
request.source(data);

```

---

<div class="post-metadata">

**Author:** ![swallez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swallez/32/11972_2.png) [@swallez](https://discuss.elastic.co/u/swallez)\
**Post date:** [August 14, 2023, 10:20am UTC](https://discuss.elastic.co/t/json-serialization-differences-from-hlrc-to-new-java-api-client/340651/2 "2023-08-14T10:20:40Z")

</div>

The Java API client uses an object mapper (typically Jackson) to serialize values. You should configure it so that it uses this format.

This article explains various way to achieve that: [https://www.baeldung.com/jackson-serialize-dates](https://www.baeldung.com/jackson-serialize-dates)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 11, 2023, 10:20am UTC](https://discuss.elastic.co/t/json-serialization-differences-from-hlrc-to-new-java-api-client/340651/3 "2023-09-11T10:20:55Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
