Get JSON response from TCP input

I need some help with how to convert an input received from a TCP input node to a JSON object in Node Red.
I am using Logstash, which is tailing a csv file(which gets updated every 5 minutes) and then sending it to the TCP node in a Node Red flow. Using a CSV node after the TCP input node causes it generate the output in multiple lines rather than as a single JSON object.

What should be my approach to resolve this issue?

Welcome to the forum @sid99.

Show us what the data coming in looks like in a debug node and tell us what you want it be converted to. When you say you want a JSON object I presume you mean a javascript object (a JSON object is a string).