# Increament the nested Json in date field

**URL:** <https://discuss.elastic.co/t/increament-the-nested-json-in-date-field/103694>\
**Category:** Logstash\
**Created:** [October 12, 2017, 10:16am UTC](https://discuss.elastic.co/t/increament-the-nested-json-in-date-field/103694 "2017-10-12T10:16:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vignesh\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vignesh_kumar/32/41866_2.png) [@Vignesh\_Kumar](https://discuss.elastic.co/u/Vignesh_Kumar)\
**Post date:** [October 12, 2017, 10:16am UTC](https://discuss.elastic.co/t/increament-the-nested-json-in-date-field/103694/1 "2017-10-12T10:16:59Z")

</div>

Have the below field in date field which need to be incremented for length of json,

match =\> ["[Capture][0][TimeStamp]", "yyyyMMddHHmmss"]

In this [0] has to increamented. please help

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [October 12, 2017, 11:03am UTC](https://discuss.elastic.co/t/increament-the-nested-json-in-date-field/103694/2 "2017-10-12T11:03:19Z")

</div>

It's very hard to understand what you're asking. Please given an example of what your event currently looks like (use a `stdout { codec => rubydebug }` output) and what you want it to look like instead.

---

<div class="post-metadata">

**Author:** ![Vignesh\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vignesh_kumar/32/41866_2.png) [@Vignesh\_Kumar](https://discuss.elastic.co/u/Vignesh_Kumar)\
**Post date:** [October 12, 2017, 12:24pm UTC](https://discuss.elastic.co/t/increament-the-nested-json-in-date-field/103694/3 "2017-10-12T12:24:09Z")

</div>

The input Json is as below,  
{  
"Properties": {  
"Client Name": "Chubb",  
"Portfolio": "Chubb-Transfer",  
"ProcessName": "TransferScenario0926"  
},  
"Capture": [  
{  
"CaptureGUID": "0faf6b54-999f-4bfd-b8d0-e81a589f9185",  
"HTMLPath": "Captures\C:\",  
"ScreenName": "Microsoft Excel - 1.0.1 1.0.6 1.0.8 Match 3.0.6 Hit NAIC Optimized.xlsx",  
"TimeStamp": "20170926105419"  
},  
{  
"CaptureGUID": "0faf6b54-999f-4bfd-b8d0-e81a589f9186",  
"HTMLPath": "Captures\C:\",  
"ScreenName": "Microsoft Excel - 1.0.1 1.0.6 1.0.8 Match 3.0.6 Hit NAIC Optimized.xlsx",  
"TimeStamp": "20170926105420"  
},  
{  
"CaptureGUID": "0faf6b54-999f-4bfd-b8d0-e81a589f9187",  
"HTMLPath": "Captures\C:\",  
"ScreenName": "Microsoft Excel - 1.0.1 1.0.6 1.0.8 Match 3.0.6 Hit NAIC Optimized.xlsx",  
"TimeStamp": "20170926105421"  
}  
]  
}  
Wherein i want covert the **TimeStamp** to date field which i tried using  
match =\> ["[Capture][0][TimeStamp]", "yyyyMMddHHmmss"]. which is converting the first [0] object only.  
I want an output as below,  
{  
"Properties": {  
"Client Name": "Chubb",  
"Portfolio": "Chubb-Transfer",  
"ProcessName": "TransferScenario0926",  
},  
"Capture": [  
[0]{  
"CaptureGUID": "0faf6b54-999f-4bfd-b8d0-e81a589f9185",  
"HTMLPath": "Captures\C:\",  
"ScreenName": "Microsoft Excel - 1.0.1 1.0.6 1.0.8 Match 3.0.6 Hit NAIC Optimized.xlsx",  
"TimeStamp": "20170926105419",  
"StartTime" =\> 2017-09-26T10:54:19.000Z  
},  
[1] {  
"CaptureGUID": "0faf6b54-999f-4bfd-b8d0-e81a589f9186",  
"HTMLPath": "Captures\C:\",  
"ScreenName": "Microsoft Excel - 1.0.1 1.0.6 1.0.8 Match 3.0.6 Hit NAIC Optimized.xlsx",  
"TimeStamp": "20170926105420",  
"StartTime" =\> 2017-09-26T10:54:20.000Z  
},  
[2]{  
"CaptureGUID": "0faf6b54-999f-4bfd-b8d0-e81a589f9187",  
"HTMLPath": "Captures\C:\",  
"ScreenName": "Microsoft Excel - 1.0.1 1.0.6 1.0.8 Match 3.0.6 Hit NAIC Optimized.xlsx",  
"TimeStamp": "20170926105421",  
"StartTime" =\> 2017-09-26T10:54:21.000Z  
}  
]  
}

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [October 12, 2017, 12:45pm UTC](https://discuss.elastic.co/t/increament-the-nested-json-in-date-field/103694/4 "2017-10-12T12:45:56Z")

</div>

I'm assuming the number of elements in the `Capture` array isn't know, in which case you'll have to use a ruby filter to loop over the elements and parse the `TimeStamp` field in each.

Do you really want `Capture` to continue being an array in a single document? Are you sure you don't want to extract each element into its own document?

---

<div class="post-metadata">

**Author:** ![Vignesh\_Kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vignesh_kumar/32/41866_2.png) [@Vignesh\_Kumar](https://discuss.elastic.co/u/Vignesh_Kumar)\
**Post date:** [October 12, 2017, 1:05pm UTC](https://discuss.elastic.co/t/increament-the-nested-json-in-date-field/103694/5 "2017-10-12T13:05:57Z")

</div>

Thank you and this is example i have give i have three date format like in my json and files are more large size with many json objects. if i can solve this date handling it will be a great help

---

<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:** [November 9, 2017, 1:06pm UTC](https://discuss.elastic.co/t/increament-the-nested-json-in-date-field/103694/6 "2017-11-09T13:06:08Z")

</div>

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