# How to serialize/deserialize FieldValue object?

**URL:** <https://discuss.elastic.co/t/how-to-serialize-deserialize-fieldvalue-object/341498>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [August 23, 2023, 3:40pm UTC](https://discuss.elastic.co/t/how-to-serialize-deserialize-fieldvalue-object/341498 "2023-08-23T15:40:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![icruces](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/icruces/32/121753_2.png) [@icruces](https://discuss.elastic.co/u/icruces)\
**Post date:** [August 23, 2023, 3:40pm UTC](https://discuss.elastic.co/t/how-to-serialize-deserialize-fieldvalue-object/341498/1 "2023-08-23T15:40:24Z")

</div>

I have upgraded the Java API from 8.2 to the latest. The method `Hit::sort` now returns a `List<FieldValue>` instead of `List<String>`. I understand this is the correct way but it breaks my app as I was base64 encoding/decoding those sort string values.

I am in the process of migrating it to use `FieldValue` and I wonder if there is an easy way of serializing/deserializing a `FieldValue` object to/from a `String`. I see the `FieldValue` class is `JsonpDeserializable` but I don't find information about how to take advantage of it.

---

<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 20, 2023, 3:40pm UTC](https://discuss.elastic.co/t/how-to-serialize-deserialize-fieldvalue-object/341498/2 "2023-09-20T15:40:55Z")

</div>

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