<?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>topic Re: JSONObject text must begin with '{' at 1 [character 2 line 1] in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/JSONObject-text-must-begin-with-at-1-character-2-line-1/m-p/2296620#M69268</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;what's the content of "output" ?&lt;/P&gt;</description>
    <pubDate>Tue, 12 Apr 2022 04:13:57 GMT</pubDate>
    <dc:creator>jzhao</dc:creator>
    <dc:date>2022-04-12T04:13:57Z</dc:date>
    <item>
      <title>JSONObject text must begin with '{' at 1 [character 2 line 1]</title>
      <link>https://community.qlik.com/t5/Talend-Studio/JSONObject-text-must-begin-with-at-1-character-2-line-1/m-p/2296619#M69267</link>
      <description>&lt;P&gt;I am creating a workflow to extract the json string from spark job in the tSystem using tJava:&lt;/P&gt;&lt;P&gt;&lt;B&gt;tSystem -&amp;gt; tJava&amp;nbsp;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected output is, firstly, tSystem will give&amp;nbsp;the string result in the form of &lt;A href="https://log.info" alt="https://log.info" target="_blank"&gt;log.info&lt;/A&gt;() and also in json format. Later, tJava will extract and only print out the json string while ignore the other string format.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Spark output from tSystem:&lt;/P&gt;&lt;P&gt;&lt;B&gt;String output=((String)globalMap.get("tSystem_3_OUTPUT"));&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;JSONObject jsonObject = new JSONObject(output);&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;System.out.println(jsonObject);&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;String sourceCount=(jsonObject.getString("Source rows"));&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;System.out.println("Database Name: "+jsonObject.getString("DBName"));&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;globalMap.put("sourceCount",sourceCount.trim());&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I run my current workflow, the following error appears which I believe is because my java code in tJava tried to read the string in all format , instead of json string only.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error in tJava:&lt;/P&gt;&lt;P&gt;&lt;B&gt;FATAL] 11:18:46 nerve_ingestion.fullrefreshingestion_dev_0_15.FullRefreshIngestion_Dev- tJava_3 A JSONObject text must begin with '{' at 1 [character 2 line 1]&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;routines.system.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;	at routines.system.JSONTokener.syntaxError(JSONObject.java:1790) ~[routines.jar:?]&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;	at routines.system.JSONObject.&amp;lt;init&amp;gt;(JSONObject.java:166) ~[routines.jar:?]&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;	at routines.system.JSONObject.&amp;lt;init&amp;gt;(JSONObject.java:279) ~[routines.jar:?]&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How should i change the java code to ensure tJava only capture the json string?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 23:01:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/JSONObject-text-must-begin-with-at-1-character-2-line-1/m-p/2296619#M69267</guid>
      <dc:creator>WSyahirah21</dc:creator>
      <dc:date>2024-11-15T23:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: JSONObject text must begin with '{' at 1 [character 2 line 1]</title>
      <link>https://community.qlik.com/t5/Talend-Studio/JSONObject-text-must-begin-with-at-1-character-2-line-1/m-p/2296620#M69268</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;what's the content of "output" ?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 04:13:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/JSONObject-text-must-begin-with-at-1-character-2-line-1/m-p/2296620#M69268</guid>
      <dc:creator>jzhao</dc:creator>
      <dc:date>2022-04-12T04:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: JSONObject text must begin with '{' at 1 [character 2 line 1]</title>
      <link>https://community.qlik.com/t5/Talend-Studio/JSONObject-text-must-begin-with-at-1-character-2-line-1/m-p/2296621#M69269</link>
      <description>&lt;P&gt;Hi jzhao,&lt;/P&gt;&lt;P&gt;Issue solved. Basically I did following step in tJava:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Use substring between “ingestion start” and “ingestion end” to capture that json line in spark job result. &lt;/LI&gt;&lt;LI&gt;Do some cleanup until u get that jsonobject only.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for responding! &lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 19:53:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/JSONObject-text-must-begin-with-at-1-character-2-line-1/m-p/2296621#M69269</guid>
      <dc:creator>WSyahirah21</dc:creator>
      <dc:date>2022-04-12T19:53:02Z</dc:date>
    </item>
  </channel>
</rss>

