---
title: "Get the first value from a json array"  
description: "Get the first value from a json array"  
author: "Anonymous User"  
published: 2013-06-20  
updated: 2013-06-20  
canonical: https://www.mindstick.com/forum/1246/get-the-first-value-from-a-json-array  
category: "json"  
tags: ["json"]  
reading_time: 1 minute  

---

# Get the first value from a json array

Hi Everyone,\
I have JSON coming from the [database](https://www.mindstick.com/articles/12226/use-of-database-in-sencha-extjs-and-insert-record-from-user-form-using-ajax) that's shaped like this:\
**var data = {** **"zone01": [{** **"[region](https://www.mindstick.com/forum/158172/what-is-the-dholera-special-investment-region-in-gujarat)": "North",** **"state": "New York",** **"county": "Albany",** **"code": "01"** **}, {** **"region": "North",** **"state": "New York",** **"county": "Albany",** **"code": "05"** **}, {** **"region": "North",** **"state": "Maine",** **"county": "Auburn",** **"code": "07"** **}],** **"zone02": [{** **"region": "South",** **"state": "Florida",** **"county": "Gainseville",** **"code": "82"** **}, {** **"region": "South",** **"state": "Florida",** **"county": "Macclenny",** **"code": "73"** **}]****};****\**I'm [trying](https://answers.mindstick.com/qa/93698/6-mistakes-couples-are-trying-to-save-money) to get a list of the first set of [values](https://www.mindstick.com/forum/327/sum-textbox-values) "zone01", "zone02" etc... in [order](https://www.mindstick.com/articles/12276/how-timely-order-deliveries-can-improve-customer-experience) to [populate](https://www.mindstick.com/blog/60/populate-records-in-second-listbox-according-to-the-selection-in-first-list-box) a [select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) input. By selecting the zone you'll be able to select down the list but I can't seem to get a list of the zones.\
I tried:\
**$.each(data, [function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server)(index, element){** **var zone = JSON.stringify(element.index);** **$('#zone').append('<[option](https://www.mindstick.com/forum/159391/jquery-get-selected-option-from-dropdown) [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages)="'+zone+'">'+zone+'</option>');****});****\**Thanks in advance.

## Replies

### Reply by AVADHESH PATEL

Hi Garry,\
You simply need to use index, not element.index.\
**var zone = JSON.stringify(index);****\**element refers to the value on the right side of the colon. It does not have an index property.\
index refers to the identifier on the left side of the colon. This is exactly what you want.


---

Original Source: https://www.mindstick.com/forum/1246/get-the-first-value-from-a-json-array

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
