Parsing JSON along with double Quotes

Hi all,

I am trying to parse the following json which contains spec field.

{"multiplier":1,"name":"bullet","spec":"Deluxe Sink, two compartment, 87"W x 30"D x 41"H, 16/300 stainless steel, 24" x 24" x 11-1/2" deep compartments, 36" with stainless steel adjustable feet, NSF"}

To get the output as in csv with every field enclosed by double quotes.
For eg: "1","bullet","Deluxe Sink,.......................,NSF"

To get enclosed with double quotes , i am adding a Quotes field in filter and concatenating it with the file input plugin

filter
{ mutate {add_field => {"Quotes" => ' " '} }
}

output {file {
path => ["E:\work\logstash\logstash-5.5.0\input\FOB.csv"]
codec => line { format => "%{Quotes}%{multiplier}%{Quotes},%{Quotes}%{name}%{Quotes},%{Quotes}%{spec}%{Quotes}"}
}
}

But the comma inside the spec field is being separated to other fields

Please guide me , Thanks in Advance

The JSON string you provided is not valid JSON. To make this valid JSON you need to escape the quotes within the spec field:

{
	"multiplier": 1,
	"name": "bullet",
	"spec": "Deluxe Sink, two compartment, 87\"W x 30\"D x 41\"H, 16/300 stainless steel, 24\" x 24\" x 11-1/2\" deep compartments, 36\" with stainless steel adjustable feet, NSF"
}

Easiest way to sort this might be to change the source to emit valid JSON so that you can use the json filter.