<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Pattern: convert CSV to JSON? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Pattern-convert-CSV-to-JSON/m-p/95503#M58862</link>
    <description>&lt;P&gt;There might be a cleaner way to do this, but if you had an incoming CSV like:&lt;/P&gt;&lt;P&gt;h1,h2,h3,h4&lt;/P&gt;&lt;P&gt;v1,v2,v3,v4&lt;/P&gt;&lt;P&gt;You could capture that in ExtractText with a pattern of:&lt;/P&gt;&lt;P&gt;(.+),(.+),(.+),(.+)\n(.+),(.+),(.+),(.+)&lt;/P&gt;&lt;P&gt;Then in ReplaceText:&lt;/P&gt;&lt;P&gt;{ "${csv.1}" : "${csv.5}", "${csv.2}" : "${csv.6}", "${csv.3}" : "${csv.7}", "${csv.4}" : "${csv.8}" }&lt;/P&gt;&lt;P&gt;Would produce:&lt;/P&gt;&lt;P&gt;{ "h1" : "v1", "h2" : "v2", "h3" : "v3", "h4" : "v4" }&lt;/P&gt;</description>
    <pubDate>Thu, 15 Oct 2015 22:53:39 GMT</pubDate>
    <dc:creator>bbende</dc:creator>
    <dc:date>2015-10-15T22:53:39Z</dc:date>
    <item>
      <title>Pattern: convert CSV to JSON?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Pattern-convert-CSV-to-JSON/m-p/95499#M58858</link>
      <description>&lt;P&gt;Hi, what's the recommended processor sequence to parse single-line csv entries into JSON? I'm all set on ingest and egress, but a little fuzzy on the conversion part still.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2015 21:07:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Pattern-convert-CSV-to-JSON/m-p/95499#M58858</guid>
      <dc:creator>andrewg</dc:creator>
      <dc:date>2015-10-15T21:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern: convert CSV to JSON?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Pattern-convert-CSV-to-JSON/m-p/95500#M58859</link>
      <description>&lt;P&gt;How about  - ConvertCSVToAvro - &amp;amp; then - ConvertAvroToJSON ?&lt;/P&gt;&lt;P&gt;Alternatively, You can use ExtractText with regex to convert CSV to JSON.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2015 21:15:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Pattern-convert-CSV-to-JSON/m-p/95500#M58859</guid>
      <dc:creator>bsaini</dc:creator>
      <dc:date>2015-10-15T21:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern: convert CSV to JSON?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Pattern-convert-CSV-to-JSON/m-p/95501#M58860</link>
      <description>&lt;P&gt;If you have a fixed set of columns in the csv that you know ahead of time, you can use ExtractText + ReplaceText. This was an example I created once before, rename to .xml:  &lt;A href="https://community.cloudera.com/legacyfs/online/attachments/246-csvtojson.txt"&gt;csvtojson.txt&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2015 21:34:24 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Pattern-convert-CSV-to-JSON/m-p/95501#M58860</guid>
      <dc:creator>bbende</dc:creator>
      <dc:date>2015-10-15T21:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern: convert CSV to JSON?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Pattern-convert-CSV-to-JSON/m-p/95502#M58861</link>
      <description>&lt;P&gt;Yes, it's a known CSV with a header line. I wonder if there's a trick to use the column names and expression language to avoid manual re-typing.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2015 21:42:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Pattern-convert-CSV-to-JSON/m-p/95502#M58861</guid>
      <dc:creator>andrewg</dc:creator>
      <dc:date>2015-10-15T21:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern: convert CSV to JSON?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Pattern-convert-CSV-to-JSON/m-p/95503#M58862</link>
      <description>&lt;P&gt;There might be a cleaner way to do this, but if you had an incoming CSV like:&lt;/P&gt;&lt;P&gt;h1,h2,h3,h4&lt;/P&gt;&lt;P&gt;v1,v2,v3,v4&lt;/P&gt;&lt;P&gt;You could capture that in ExtractText with a pattern of:&lt;/P&gt;&lt;P&gt;(.+),(.+),(.+),(.+)\n(.+),(.+),(.+),(.+)&lt;/P&gt;&lt;P&gt;Then in ReplaceText:&lt;/P&gt;&lt;P&gt;{ "${csv.1}" : "${csv.5}", "${csv.2}" : "${csv.6}", "${csv.3}" : "${csv.7}", "${csv.4}" : "${csv.8}" }&lt;/P&gt;&lt;P&gt;Would produce:&lt;/P&gt;&lt;P&gt;{ "h1" : "v1", "h2" : "v2", "h3" : "v3", "h4" : "v4" }&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2015 22:53:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Pattern-convert-CSV-to-JSON/m-p/95503#M58862</guid>
      <dc:creator>bbende</dc:creator>
      <dc:date>2015-10-15T22:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern: convert CSV to JSON?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Pattern-convert-CSV-to-JSON/m-p/95504#M58863</link>
      <description>&lt;P&gt;I would use ExtractText with Regex and then AttributestoJSON processor to create a JSON formated flow file.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2016 07:05:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Pattern-convert-CSV-to-JSON/m-p/95504#M58863</guid>
      <dc:creator>vvaks</dc:creator>
      <dc:date>2016-03-28T07:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern: convert CSV to JSON?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Pattern-convert-CSV-to-JSON/m-p/95505#M58864</link>
      <description>&lt;P&gt;I have a convertCSVtoJSON processor.  Will see about getting it contributed back.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Sep 2016 02:26:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Pattern-convert-CSV-to-JSON/m-p/95505#M58864</guid>
      <dc:creator>randybovay</dc:creator>
      <dc:date>2016-09-10T02:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern: convert CSV to JSON?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Pattern-convert-CSV-to-JSON/m-p/95506#M58865</link>
      <description>&lt;P&gt;any word on your contribution ? I can use a csv2json processor/sequence now !!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 20:46:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Pattern-convert-CSV-to-JSON/m-p/95506#M58865</guid>
      <dc:creator>me2</dc:creator>
      <dc:date>2017-07-07T20:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern: convert CSV to JSON?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Pattern-convert-CSV-to-JSON/m-p/95507#M58866</link>
      <description>&lt;P&gt;In Apache NiFi 1.2.0 and 1.3.0 (HDF 3.0.0) there is a ConvertRecord processor that can convert between any combination of Avro, JSON, and CSV.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 21:32:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Pattern-convert-CSV-to-JSON/m-p/95507#M58866</guid>
      <dc:creator>bbende</dc:creator>
      <dc:date>2017-07-07T21:32:37Z</dc:date>
    </item>
  </channel>
</rss>

