# Get JSON Array out of a property value

**URL:** https://discuss.elastic.co/t/get-json-array-out-of-a-property-value/52667
**Category:** Logstash
**Created:** [June 13, 2016, 9:41pm UTC](https://discuss.elastic.co/t/get-json-array-out-of-a-property-value/52667 "2016-06-13T21:41:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mmarkzon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mmarkzon/32/63054_2.png) [@mmarkzon](https://discuss.elastic.co/u/mmarkzon)
#### Post date: [June 13, 2016, 9:41pm UTC](https://discuss.elastic.co/t/get-json-array-out-of-a-property-value/52667/1 "2016-06-13T21:41:16Z")

</div>

I am importing into Elastic.  
My log file looks like this:  
`{"Transmission":{"Value":"{ "Users": [{"ArtifactID": 123123}] }"}}`

I am having difficulty getting the json value out of Users as an array so that it can be formatted like this in Elastic:  
`
"TransmissionJson" => {
"Users" => [
[0] {
"ArtifactID" => 123123
}
]
}
`  
Unfortunately when I parse this with logstash, the Users value gets flattened and is no longer an array:  
`"Users" => "{"ArtifactID"=>123123}"`

Any suggestions? Thanks!

My config looks like this:  
`
input {
file {
path => ["C:/MetricsLogs/**/*.log"]
start_position => "beginning"
codec => "json"
}
}`

filter {  
mutate {  
add\_field =\> { "source" =\> "%{[TransmissionJson]}" }  
}  
json {  
source =\> "source"  
remove\_field =\> "source"  
}  
grok {  
match =\> { "[Value]" =\> "%{GREEDYDATA:workspaceJson}" }  
}  
json {  
source =\> "workspaceJson"  
target =\> "parsedJson"  
remove\_field =\> "workspaceJson"  
}  
mutate {  
add\_field =\> { "Users" =\> "%{[parsedJson][Users]}"}  
}  
}

output {  
stdout { codec =\> rubydebug }  
}

---

<div class="post-metadata">

### Author: ![mmarkzon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mmarkzon/32/63054_2.png) [@mmarkzon](https://discuss.elastic.co/u/mmarkzon)
#### Post date: [June 14, 2016, 9:09pm UTC](https://discuss.elastic.co/t/get-json-array-out-of-a-property-value/52667/2 "2016-06-14T21:09:10Z")

</div>

I got this working. I think the mutate just doesn't work with arrays. I used a ruby filter.  
`
ruby {
code => "event['Users'] = event['Transmission']['Value']['Users'] "
}
`

---

<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: [July 6, 2017, 4:52am UTC](https://discuss.elastic.co/t/get-json-array-out-of-a-property-value/52667/3 "2017-07-06T04:52:54Z")

</div>


