# Max depth in decode\_json\_fields not working

**URL:** https://discuss.elastic.co/t/max-depth-in-decode-json-fields-not-working/198874
**Category:** Beats
**Tags:** filebeat
**Created:** [September 10, 2019, 10:28am UTC](https://discuss.elastic.co/t/max-depth-in-decode-json-fields-not-working/198874 "2019-09-10T10:28:46Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![w00f](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/w00f/32/53910_2.png) [@w00f](https://discuss.elastic.co/u/w00f)
#### Post date: [September 10, 2019, 10:28am UTC](https://discuss.elastic.co/t/max-depth-in-decode-json-fields-not-working/198874/1 "2019-09-10T10:28:46Z")

</div>

I am trying to decode a json fields and try to limit the depth to 1.

My config as below:

```auto
        - decode_json_fields:
            fields: ["message"]
            process_array: true
            max_depth: 1
            target: "logger"
            overwrite_keys: true

```

And here is the original message field:

```auto
"message":"{\"timestamp\":\"2019-09-10T16:53:57.723998+08:00\",\"level\":\"INFO\",\"logger\":\"Rails\",\"message\":{\"method\":\"PUT\",\"path\":\"/api/workforces/profiles/159\",\"format\":\"json\",\"controller\":\"Hubble::Workforces::Api::V1::ProfilesController\",\"action\":\"update\",\"status\":200,\"duration\":117.48,\"view\":5.68,\"db\":23.94,\"params\":{\"name\":\"Green Earth Admin 01\"}},\"exception\":null,\"stacktrace\":null}",

```

Somehow, the params field are expanded and cause us a lot of problems since this field normally contains 2-3 level of nested json fields.

May I know what am I doing wrong and what can I do in this situation?

---

<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: [October 8, 2019, 10:38am UTC](https://discuss.elastic.co/t/max-depth-in-decode-json-fields-not-working/198874/2 "2019-10-08T10:38:16Z")

</div>

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