<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Reading JSON from *.json File</title><link>https://community.appian.com/discussions/f/data/13238/reading-json-from-json-file</link><description>Hello All, 
 
 I have a JSON file from which i need to read data. The file is not in any particular format and may have about 45,000 lines of data. 
 To read document file the the only function i can find is readtextfromfile but problem with this function</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Reading JSON from *.json File</title><link>https://community.appian.com/thread/70735?ContentTypeID=1</link><pubDate>Thu, 28 Nov 2019 11:55:47 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f95ef1e0-2b14-4713-94c4-5f180e7d818c</guid><dc:creator>rakeshp0004</dc:creator><description>&lt;p&gt;Thanks for this one it helps to know that using null inside will result in error before hand.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JSON from *.json File</title><link>https://community.appian.com/thread/70734?ContentTypeID=1</link><pubDate>Thu, 28 Nov 2019 11:55:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d91a9a95-187e-45c8-86a3-a977fa5d7609</guid><dc:creator>rakeshp0004</dc:creator><description>&lt;p&gt;Your post is the reason i stumbled on to&amp;nbsp;&lt;strong&gt;readtextfromfile&amp;nbsp;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Thanks :-)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JSON from *.json File</title><link>https://community.appian.com/thread/59868?ContentTypeID=1</link><pubDate>Fri, 31 Aug 2018 13:36:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:db1e0007-914b-4928-ab78-eec3f828011d</guid><dc:creator>mudit</dc:creator><description>Thanks for reply. But in our case we are getting JSON from external system and it does not have a defined format.  &lt;br /&gt;
&lt;br /&gt;
The issue is now resolved as i stated above.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JSON from *.json File</title><link>https://community.appian.com/thread/59856?ContentTypeID=1</link><pubDate>Fri, 31 Aug 2018 12:27:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6d492d67-22a2-4548-b998-b4e0cbf811d8</guid><dc:creator>roopeshv</dc:creator><description>Try this &lt;br /&gt;
&lt;br /&gt;
load(&lt;br /&gt;
  local!inputData: &amp;quot;{&lt;br /&gt;
	&amp;quot;&amp;quot;age&amp;quot;&amp;quot;: 100,&lt;br /&gt;
	&amp;quot;&amp;quot;name&amp;quot;&amp;quot;: &amp;quot;&amp;quot;xyz.com&amp;quot;&amp;quot;,&lt;br /&gt;
&amp;quot;&amp;quot;messages&amp;quot;&amp;quot;:[&amp;quot;&amp;quot;msg 1&amp;quot;&amp;quot;,&amp;quot;&amp;quot;msg 2&amp;quot;&amp;quot;,&amp;quot;&amp;quot;msg 3&amp;quot;&amp;quot;]&lt;br /&gt;
}&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
index(&lt;br /&gt;
  {a!fromJson(&lt;br /&gt;
   local!inputData&lt;br /&gt;
  )},&lt;br /&gt;
  &amp;quot;messages&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
)&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JSON from *.json File</title><link>https://community.appian.com/thread/59853?ContentTypeID=1</link><pubDate>Fri, 31 Aug 2018 12:03:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7f1f0cc6-85bd-4130-bd99-e424074e2edd</guid><dc:creator>mudit</dc:creator><description>&lt;p&gt;Found an answer from this&amp;nbsp;&lt;a href="/support/w/kb/458/kb-1243-the-jsontext-parameter-of-a-fromjson-was-not-valid-json-error-thrown-when-executing-a-fromjson-querying-a-json-object-with-a-null-value" target="_blank"&gt;link&lt;/a&gt;. Thanks for quick reply everyone.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;NOTE: I had null data in my JSON, i used substitute to replace null with &amp;quot;&amp;quot;.&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JSON from *.json File</title><link>https://community.appian.com/thread/59852?ContentTypeID=1</link><pubDate>Fri, 31 Aug 2018 11:54:15 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:87d19d07-2527-4513-b4b3-47d665bba1a5</guid><dc:creator>mudit</dc:creator><description>OK I figured the issue in above example but, in my case i am still getting the same error though the JSON is valid when i checked it online&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JSON from *.json File</title><link>https://community.appian.com/thread/59845?ContentTypeID=1</link><pubDate>Fri, 31 Aug 2018 10:21:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6fd97827-60cf-46be-bbd6-cf2191b68708</guid><dc:creator>mudit</dc:creator><description>I tried this but got this error.  &lt;br /&gt;
Note: I used the same JSON you have added above&lt;br /&gt;
&lt;br /&gt;
Expression evaluation error at function a!fromJson [line 2]: Error evaluating function fn!fromjson_appian_internal : The jsonText parameter was not valid JSON. Received: ﻿{ &amp;quot;age&amp;quot;:100, &amp;quot;name&amp;quot;:&amp;quot;xyz.com&amp;quot;, &amp;quot;messages&amp;quot;:[&amp;quot;msg 1&amp;quot;,&amp;quot;msg 2&amp;quot;,&amp;quot;msg 3&amp;quot;] }&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JSON from *.json File</title><link>https://community.appian.com/thread/59806?ContentTypeID=1</link><pubDate>Thu, 30 Aug 2018 17:44:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:38779208-660b-4496-9066-c6a93b73a9ff</guid><dc:creator>Robert Shankin</dc:creator><description>&lt;p&gt;I think this is what you&amp;#39;re looking for:&lt;/p&gt;
&lt;p&gt;Assuming &lt;strong&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;cons!SBX_DOCUMENT_JSON_EXAMPLE&lt;/span&gt;&lt;/strong&gt; is a constant of type document, and the content of that document is:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt; &amp;quot;age&amp;quot;:100,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt; &amp;quot;name&amp;quot;:&amp;quot;xyz.com&amp;quot;,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt; &amp;quot;messages&amp;quot;:[&amp;quot;msg 1&amp;quot;,&amp;quot;msg 2&amp;quot;,&amp;quot;msg 3&amp;quot;]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;THEN&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;index(
  {a!fromJson(
    {fn!readtextfromfile(cons!SBX_DOCUMENT_JSON_EXAMPLE, true())}
  )},
  &amp;quot;messages&amp;quot;
)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;RETURNS:&lt;/strong&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;List of Text String: 3 items
    &amp;quot;msg 1&amp;quot;
    &amp;quot;msg 2&amp;quot;
    &amp;quot;msg 3&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;AND&lt;/strong&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;index(
  {a!fromJson(
    {fn!readtextfromfile(cons!SBX_DOCUMENT_JSON_EXAMPLE, true())}
  )},
  &amp;quot;age&amp;quot;
)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;RETURNS:&lt;/strong&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;100&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JSON from *.json File</title><link>https://community.appian.com/thread/59761?ContentTypeID=1</link><pubDate>Thu, 30 Aug 2018 06:19:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:529dfd3a-a1e2-4095-bb84-410e61a0d229</guid><dc:creator>mudit</dc:creator><description>Hi Siva,&lt;br /&gt;
&lt;br /&gt;
I have read above post. But the solution suggested there is to user readTextFromFile which i am already doing, the issue with that function is it converts data into a single text string . and thus we are not able to use fromJson.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JSON from *.json File</title><link>https://community.appian.com/thread/59758?ContentTypeID=1</link><pubDate>Thu, 30 Aug 2018 05:58:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b7bc621a-e808-4b25-a168-6d37eb1c03e1</guid><dc:creator>Siva</dc:creator><description>Hi muditm,&lt;br /&gt;
&lt;br /&gt;
Please refer the below thread. It might help for your use case.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="https://community.appian.com/discussions/f/integrations/11096/reading-json-data-from-a-document"&gt;community.appian.com/.../reading-json-data-from-a-document&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Thanks&lt;br /&gt;
Siva Chimata&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>