# Postgresql problem parse geomretry

**URL:** <https://discuss.elastic.co/t/postgresql-problem-parse-geomretry/159723>\
**Category:** Logstash\
**Created:** [December 6, 2018, 12:09pm UTC](https://discuss.elastic.co/t/postgresql-problem-parse-geomretry/159723 "2018-12-06T12:09:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![elasitcboy](https://avatars.discourse-cdn.com/v4/letter/e/df705f/32.png) [@elasitcboy](https://discuss.elastic.co/u/elasitcboy)\
**Post date:** [December 6, 2018, 12:09pm UTC](https://discuss.elastic.co/t/postgresql-problem-parse-geomretry/159723/1 "2018-12-06T12:09:13Z")

</div>

Hello,

need help with logstash parser...

and postgresql query:

```
SELECT st_asgeojson(st_makevalid(jj.point)) AS location FROM table

{
  "_index": "test",
  "_type": "doc",
  "_id": "1111",
  "_version": 1,
  "_score": null,
  "_source": {
    "type": "testt",
    "description": "testt",
    "@version": "1",
    "location": "{\"type\":\"Point\",\"coordinates\":[15.9774477559483,45.8111717248469]}",
 "fields": {
    "@timestamp": [
      "2015-12-06T10:10:08.171Z"
    ]
  },
  "sort": [
    1544091008171
  ]
}

```

I need parse "location" to:

```
{
    "location" : {
        "type" : "point",
        "coordinates" : [-77.03653, 38.897676]
    }
}

```

But I get in index:

> "location": "{"type":"Point","coordinates":[15.9774477559483,45.8111717248469]}",

In logstash config i use:

```
filter {
  json {
    source => "location"
    target => "json"  
  }
}

```

and get

```
 "json": {
      "coordinates": [
        18.8057406022342,
        45.2884932853786
      ],
      "type": "Point"
    },

```

---

<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:** [January 3, 2019, 12:09pm UTC](https://discuss.elastic.co/t/postgresql-problem-parse-geomretry/159723/2 "2019-01-03T12:09:20Z")

</div>

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