# Get sequential relation of keys in a json file in ruby logstash

**URL:** <https://discuss.elastic.co/t/get-sequential-relation-of-keys-in-a-json-file-in-ruby-logstash/300566>\
**Category:** Logstash\
**Created:** [March 24, 2022, 11:44am UTC](https://discuss.elastic.co/t/get-sequential-relation-of-keys-in-a-json-file-in-ruby-logstash/300566 "2022-03-24T11:44:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zubair\_aftab](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zubair_aftab/32/103257_2.png) [@zubair\_aftab](https://discuss.elastic.co/u/zubair_aftab)\
**Post date:** [March 24, 2022, 11:44am UTC](https://discuss.elastic.co/t/get-sequential-relation-of-keys-in-a-json-file-in-ruby-logstash/300566/1 "2022-03-24T11:44:38Z")

</div>

I have a json file of a packet capture. It has multiple layers in 1 message as shown in below example.

block 1:  
mtp3 = 1  
map = 1

block 2:  
mtp3 =2  
bicc =2

When i process the file in logstash it combines the similar layers and display them in the same field.

mtp3: 1,2 , map: 1, bicc: 2

I want my bicc from block 2 to correspond to mtp3 of block2 but it gets related to mtp3 of block1 because it is taking as first instance for both in the respective arrays.

How do i get 1 to 1 relation for all layers in the same block??

---

<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:** [April 21, 2022, 11:45am UTC](https://discuss.elastic.co/t/get-sequential-relation-of-keys-in-a-json-file-in-ruby-logstash/300566/2 "2022-04-21T11:45:01Z")

</div>

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