I am parsing a JSON from http_poller. The JSON contains an array of coordinates with 3 numbers in the array. Only the first 2 are the lat and longitude and I would like to discard the 3rd number for the time being. Is it possible to parse a JSON array by the index of the value in the array?
example JSON array
coor[5,6,7]
I would like to set 5 as lat 6 as lon
This is not the proper syntax but similar to what I want to express.
"location" => ["%{[coor][0]}","%{[coor][1]}"]
In addition to Badger's good reply, you can use mutate/copy providing that you create the location field's Array value first - needed because if the value is not a preset array type then the code will assume the nested fields are for a Hash value and you end up with fields "0" and "1" in a location Hash.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.