title: Convert text format to json in WSO2 stream processor/ regex for custom text mapping in WSO2SP
body: <p>I have a wso2 stream processor code where i am receiving <strong>input from kafka</strong> as <strong>text</strong> format because debezium mongodb connector gives out a lengthy output and it's <em>not a valid json to send to WSO2</em>. So, i am receiving it as text and plans to use regex to get only the part of payload i need.
  I am not able to figure out how to convert this text format to json so that i can send it to another kafka stream and do custom json mapping on this.</p>
  
  <p>Another approach i am trying:
  I am also trying custom mapping for text:</p>
  
  <pre><code>@source(type='kafka',
          topic.list='demo',
          partition.no.list='0',
          threading.option='single.thread',
          group.id="group",
          bootstrap.servers='localhost:9092',
   @map(type='text',fail.on.missing.attribute='false', regex.A='(.*)',
                  @attributes(id = 'A[0]')))
  define stream transactionstream1(id string);
  </code></pre>
  
  <p>Sample Json:</p>
  
  <pre><code>{"_id":{"$oid":"342fs"},"code":"ffssefse","name":"test1","desc":"description1","transRefId":"esfef3423des","amount":1000,"currency":"INR","requestId":null,"redeemedCashcode":null,"sender":{"id":"5d9c0dedcf71a09664922042","name":"tat","phone":"3242324"}}
  </code></pre>
  
  <p><strong>Regex to get code attribute from above json is</strong> : <strong><code>(?:"code":")(.*?)(?:")</code></strong>    but wso2 <strong>regex.A</strong> is not accepting this.</p>
  
  <p>Thats why currently i am getting entire data in text format and trying to convert to json</p>
  
  <p>Is there some other approach to this? or <strong>some other convention of writing regex</strong> in wso2 stream processor?</p>
  
  <p>I need to get individual attributes in custom mapping from text from the above json in wso2sp. </p>