# How to fetch first value in json file if field is coming up multiple times

**URL:** <https://discuss.elastic.co/t/how-to-fetch-first-value-in-json-file-if-field-is-coming-up-multiple-times/97357>\
**Category:** Logstash\
**Created:** [August 17, 2017, 7:47am UTC](https://discuss.elastic.co/t/how-to-fetch-first-value-in-json-file-if-field-is-coming-up-multiple-times/97357 "2017-08-17T07:47:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![deepanshu\_mittal](https://avatars.discourse-cdn.com/v4/letter/d/c6cbf5/32.png) [@deepanshu\_mittal](https://discuss.elastic.co/u/deepanshu_mittal)\
**Post date:** [August 17, 2017, 7:47am UTC](https://discuss.elastic.co/t/how-to-fetch-first-value-in-json-file-if-field-is-coming-up-multiple-times/97357/1 "2017-08-17T07:47:04Z")

</div>

Hi,

If my input json file is setting 1 field value twice in the file . Can we fetch particular value in that case?

Eg :

"message": "{"modelVersion":" 12.2.0.1.3\_20170331", "RackType":"N/A","EngineeredSystems":"Big Data Appliance","RackIdentifier":"", "OSVersion":"6.4","DBVersion":"","ExadataVersion":"","HardwareType":"",\r\n"exachkExecTimestamp":"2017-08-04 21:53:10 UTC", \r\n"exachkID":"E2103E2271EB0733E04312C0E50A10B0",\r\n"exachkType":"OS",\r\n"exachkName":"Verify NTP Synchronization", \r\n"exachkAlertType":"WARNING",\r\n"exachkTargetType":"HOST", \r\n\*_"exachkStatus":"FAIL"\*\*, \r\n"exachkStatusCode":"3", \r\n \*_"exachkStatus":"3"\*\*, \r\n"exachkmessage":"NTP is not synchronize.", \r\n"exachkMsgDetail":"DATA FROM SCAJ51BDA16-ADM - VERIFY NTP SYNCHRONIZATION \n\n\n\n remote refid st t when poll reach delay offset jitter\n==============================================================================\n 127.127.1.0 .LOCL. 10 l 39 64 377 0.000 0.000 0.001\n\*10.68.0.41 10.210.60.196 2 u 12 16 377 3.447 0.000 0.039\n+10.68.0.42 10.210.60.196 2 u 7 16 377 3.483 -0.087 0.097\n",\r\n "NodeName":"scaj51bda16-adm" \r\n}\r",

Now the value coming in exachkstatus is 3 can we set the Fail value in exachkstatus?

---

<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:** [August 17, 2017, 8:40am UTC](https://discuss.elastic.co/t/how-to-fetch-first-value-in-json-file-if-field-is-coming-up-multiple-times/97357/2 "2017-08-17T08:40:01Z")

</div>

> If my input json file is setting 1 field value twice in the file .

Then it's not valid JSON.

> Can we fetch particular value in that case?

No. Logstash's behavior with duplicate keys is undefined.

---

<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:** [September 14, 2017, 8:40am UTC](https://discuss.elastic.co/t/how-to-fetch-first-value-in-json-file-if-field-is-coming-up-multiple-times/97357/3 "2017-09-14T08:40:04Z")

</div>

Closed on September 14, 2017, 8:40am UTC

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