# Json needed for geo\_shape indexing

**URL:** <https://discuss.elastic.co/t/json-needed-for-geo-shape-indexing/769>\
**Category:** Elasticsearch\
**Created:** [May 15, 2015, 6:37pm UTC](https://discuss.elastic.co/t/json-needed-for-geo-shape-indexing/769 "2015-05-15T18:37:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmrdiscuss](https://avatars.discourse-cdn.com/v4/letter/k/db5fbb/32.png) [@kmrdiscuss](https://discuss.elastic.co/u/kmrdiscuss)\
**Post date:** [May 15, 2015, 6:37pm UTC](https://discuss.elastic.co/t/json-needed-for-geo-shape-indexing/769/1 "2015-05-15T18:37:26Z")

</div>

I have been trying out the geo\_shape type for use in our data warehouse and can successfully index and search. What I can't figure out is how I can programatically generate the needed Json in Java. Any ideas?

What I currently get.

```
{
  "name":"N1",
  "id":1000000,
  "location" : {
    "type" : "polygon",
    "coordinates" : [
	  [{"latlon":[100.0,0.0]},{"latlon":[101.0,0.0]},...
    ]
  }
}

```

What I want.

```
{
  "id" : 1000000,
  "name" : "N1",
  "location" : {
    "type" : "polygon",
    "coordinates" : [
        [[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]
    ]
}
```

---

<div class="post-metadata">

**Author:** ![kmrdiscuss](https://avatars.discourse-cdn.com/v4/letter/k/db5fbb/32.png) [@kmrdiscuss](https://discuss.elastic.co/u/kmrdiscuss)\
**Post date:** [May 15, 2015, 7:12pm UTC](https://discuss.elastic.co/t/json-needed-for-geo-shape-indexing/769/2 "2015-05-15T19:12:37Z")

</div>

The @JsonValue annotation does the trick!

Perhaps I was to quick on the draw with the post.

---

<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:** [July 6, 2017, 12:13am UTC](https://discuss.elastic.co/t/json-needed-for-geo-shape-indexing/769/3 "2017-07-06T00:13:49Z")

</div>


