Hi all,
I've got problem when trying to get some nested fields in a json object with json filter.
My field look like this
{
"total_count" : 3,
"orders" : [
{
"marketplace_order_id" : "malikilledme3",
"order_lines" : [
{
"order_line_status_pending" : "PENDING SHIPMENT",
"order_line_status_current" : "TO SHIP",
"marketplace_order_line_id" : "malikilledme3-1"
},
{
"order_line_status_pending" : "PENDING SHIPMENT",
"order_line_status_current" : "TO SHIP",
"marketplace_order_line_id" : "malikilledme3-0"
}
]
},
Original field is [http][response][body][content], I want to get value from [http][response][body][content][orders][marketplace_order_id]
I've extracted top level field , but "orders" value is a nested json, so I tried to parse it ith json filter too
json {
source => "[http][response][body][content]"
target => "[http][response][json]"
}
json {
source => "[http][response][json][orders]"
target => "[http][response][json][orders_json]"
}
But when I do this, I got a java class error exception.
2020-01-21T17:23:37,932][INFO ][logstash.agent ] Pipelines running {:count=>1, :running_pipelines=>[:api_ws], :non_running_pipelines=>}
[2020-01-21T17:23:43,428][WARN ][logstash.filters.json ] Error parsing json {:source=>"[http][response][json][orders]", :raw=>[{"marketplace_order_id"=>"malikilledme3", "order_lines"=>[{"marketplace_order_line_id"=>"malikilledme3-1", "order_line_status_pending"=>"PENDING SHIPMENT", "order_line_status_current"=>"TO SHIP"}, {"marketplace_order_line_id"=>"malikilledme3-0", "order_line_status_pending"=>"PENDING SHIPMENT", "order_line_status_current"=>"TO SHIP"}]}, {"marketplace_order_id"=>"malikilledme_again", "order_lines"=>[{"marketplace_order_line_id"=>"malikilledme_again-1", "order_line_status_pending"=>"PENDING SHIPMENT", "order_line_status_current"=>"TO SHIP"}, {"marketplace_order_line_id"=>"malikilledme_again-0", "order_line_status_pending"=>"PENDING SHIPMENT", "order_line_status_current"=>"TO SHIP"}]}, {"marketplace_order_id"=>"ws1-3_test_validation1", "order_lines"=>[{"marketplace_order_line_id"=>"ws1-3_test_validation1-0", "order_line_status_pending"=>"PENDING SHIPMENT", "order_line_status_current"=>"SHIPPED"}, {"marketplace_order_line_id"=>"ws1-3_test_validation1-1", "order_line_status_pending"=>"PENDING REFUND", "order_line_status_current"=>"SHIPPED"}]}], :exception=>java.lang.ClassCastException}
Any idea ?
regards
thomas