# How can I sort the fields order of json output

**URL:** <https://discuss.elastic.co/t/how-can-i-sort-the-fields-order-of-json-output/242987>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [July 29, 2020, 2:29am UTC](https://discuss.elastic.co/t/how-can-i-sort-the-fields-order-of-json-output/242987 "2020-07-29T02:29:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CHU\_XU](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chu_xu/32/45946_2.png) [@CHU\_XU](https://discuss.elastic.co/u/CHU_XU)\
**Post date:** [July 29, 2020, 2:29am UTC](https://discuss.elastic.co/t/how-can-i-sort-the-fields-order-of-json-output/242987/1 "2020-07-29T02:29:31Z")

</div>

Hi there,  
Found that the fields in json output have a random order even in the same event.  
For some reason, I need the fields sorted.  
The 'codec.format' acutally does but it's too complicated.  
Is there any configs may help to sort the json directly?

Thanks

---

<div class="post-metadata">

**Author:** ![mtojek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mtojek/32/63863_2.png) [@mtojek](https://discuss.elastic.co/u/mtojek)\
**Post date:** [July 29, 2020, 7:58am UTC](https://discuss.elastic.co/t/how-can-i-sort-the-fields-order-of-json-output/242987/2 "2020-07-29T07:58:32Z")

</div>

I don't think so that there is. As you said that would be another codec or modification of the existed one. You can open an Enhancement Request for beats, but please justify why do you need this feature.

---

<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:** [August 26, 2020, 9:58am UTC](https://discuss.elastic.co/t/how-can-i-sort-the-fields-order-of-json-output/242987/3 "2020-08-26T09:58:35Z")

</div>

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