# \[JAVA\] Unexpected JSON event 'VALUE\_TRUE' instead of '\[KEY\_NAME, VALUE\_STRING\]'

**URL:** <https://discuss.elastic.co/t/java-unexpected-json-event-value-true-instead-of-key-name-value-string/295740>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [January 29, 2022, 1:34am UTC](https://discuss.elastic.co/t/java-unexpected-json-event-value-true-instead-of-key-name-value-string/295740 "2022-01-29T01:34:33Z")\
**Posts on this page:** 1\
**Showing post:** 12

<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:** [January 31, 2022, 5:43pm UTC](https://discuss.elastic.co/t/java-unexpected-json-event-value-true-instead-of-key-name-value-string/295740/12 "2022-01-31T17:43:53Z")

</div>

I was able to reproduce it from the pastebin output (thanks for providing it!) and decoding it as follows:

```java
InputStream is = this.getClass().getResourceAsStream("discuss-295740.json");
JsonParser parser = mapper.jsonProvider().createParser(is);
try {
    JsonpDeserializer.of(GetIndexTemplateResponse.class).deserialize(parser, mapper);
} catch(UnexpectedJsonEventException e) {
    JsonLocation loc = e.getLocation();
    fail(loc.getLineNumber() + ":" + loc.getColumnNumber());
}

```

The result is `419:29`, which points to:

```auto
"mappings" : {
   ...
   "dynamic" : true, // <-- line 419
   "dynamic_templates" : [],
   ...

```

This is an incarnation of this isssue on read rather than on write: [Serialize DynamicMapping values as booleans instead of string · Issue #139 · elastic/elasticsearch-java · GitHub](https://github.com/elastic/elasticsearch-java/issues/139)

Please watch that issue for resolution.

---

_[View the full topic](https://discuss.elastic.co/t/java-unexpected-json-event-value-true-instead-of-key-name-value-string/295740)._
