<?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 Unpack json-like string in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Unpack-json-like-string/m-p/2490129#M101897</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I have a json-like string in a field in a loaded table. As you can see it has a lot of whitespace and new line characters in it which probably doesn't help. It also differ a bit between what is in the different sections {}&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[{
        "UID": 1,
        "Date": "Jun 23, 2021",
        "isActiveChannel": true,
        "IsConnected": false,
        "isEndInventory": false,
        "IsHeader": true,
        "IsOpenInventory": false,
        "isCalculatedActual": false
},{
      "UID": 10,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": false,
      "isEndInventory": false,
      "IsHeader": false,
      "IsOpenInventory": true,
      "isCalculatedActual": false,
      "StoragePointUID": 309,"ValuePlanned": 0,"Value": 0},{
      "UID": 2,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": true,
      "isEndInventory": false,
      "IsHeader": false,
      "IsOpenInventory": false,
      "isCalculatedActual": false,
      "StoragePointUID": 309,
      "ChannelName": "EFC1",
      "ChannelType": "Storage",
      "ChannelUID": 753,
	"IOChannel": "Incoming"},{
      "UID": 3,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": true,
      "isEndInventory": false,
      "IsHeader": false,
      "IsOpenInventory": false,
      "isCalculatedActual": false,
      "StoragePointUID": 309,
      "ChannelName": "EFC2",
      "ChannelType": "Storage",
      "ChannelUID": 761,
	"IOChannel": "Incoming"},{
      "UID": 4,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": false,
      "isEndInventory": false,
      "IsHeader": false,
      "IsOpenInventory": false,
      "isCalculatedActual": false,
      "StoragePointUID": 309,
      "ChannelName": "Local",
      "ChannelType": "Manual",
      "ChannelUID": 755,
	"IOChannel": "Outgoing"},{
      "UID": 5,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": false,
      "isEndInventory": false,
      "IsHeader": false,
      "IsOpenInventory": false,
      "isCalculatedActual": false,
      "StoragePointUID": 309,
      "ChannelName": "",
      "ChannelType": "Manual",
      "ChannelUID": 763,
	"IOChannel": "Outgoing"},{
      "UID": 6,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": false,
      "isEndInventory": false,
      "IsHeader": false,
      "IsOpenInventory": false,
      "isCalculatedActual": false,
      "StoragePointUID": 309,
      "ChannelName": "Export",
      "ChannelType": "Manual",
      "ChannelUID": 765,
	"IOChannel": "Outgoing"},{
      "UID": 7,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": true,
      "isEndInventory": false,
      "IsHeader": false,
      "IsOpenInventory": false,
      "isCalculatedActual": false,
      "StoragePointUID": 309,
      "ChannelName": "Off spec",
      "ChannelType": "Storage",
      "ChannelUID": 773,
	"IOChannel": "Outgoing"},{
      "UID": 8,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": true,
      "isEndInventory": false,
      "IsHeader": false,
      "IsOpenInventory": false,
      "isCalculatedActual": false,
      "StoragePointUID": 309,
      "ChannelName": "Damietta",
      "ChannelType": "Storage",
      "ChannelUID": 779,
	"IOChannel": "Outgoing"},{
      "UID": 9,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": true,
      "isEndInventory": false,
      "IsHeader": false,
      "IsOpenInventory": false,
      "isCalculatedActual": false,
      "StoragePointUID": 309,
      "ChannelName": "Adabiya",
      "ChannelType": "Storage",
      "ChannelUID": 907,
	"IOChannel": "Outgoing","ValueActual": 5000.00000000},{
      "UID": 11,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": false,
      "isEndInventory": true,
      "IsHeader": false,
      "IsOpenInventory": false,
      "isCalculatedActual": false,
      "StoragePointUID": 309,"ValuePlanned": -5000.00000000}]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I found the post with &lt;A href="https://community.qlik.com/t5/Design/FROM-FIELD-Is-very-powerful-It-helped-me-parse-JSON-data-stored/ba-p/2076344#comments" target="_self"&gt;From_Field&lt;/A&gt; and have tried it out with some different twists. They all kind of ends up in either of two ways, either there is no data in fields or I get a lot of synthetic keys and the load fails.&lt;BR /&gt;&lt;BR /&gt;My last try was to split up the string into sections like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Mere_Json:
 Load
 [Index],
 PurgeChar(Subfield(Replace([Json], '},{', '},,,,{'), ',,,,'), '[]') as StringJson
Resident TableWithJson
;

drop table TableWithJson;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;and then try to use From_Field&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;json_days:
load *
From_Field (Mere_Json, StringJson)(json, utf8, no labels);

STORE json_days INTO [:MyJsonList.qvd](qvd);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;It doesn't go well.&lt;BR /&gt;&lt;BR /&gt;Do any of you have any great ideas how this might be done?&lt;BR /&gt;Can I temporarily turn of the synthetic key creation part?&lt;BR /&gt;Am I doing anything obviously wrong?&lt;BR /&gt;&lt;BR /&gt;Should this somehow be solved with a inline load since I kind of have the structure for the string?&lt;BR /&gt;&lt;BR /&gt;Kind regards&lt;BR /&gt;Johan&lt;/P&gt;</description>
    <pubDate>Thu, 31 Oct 2024 11:11:54 GMT</pubDate>
    <dc:creator>_Johan</dc:creator>
    <dc:date>2024-10-31T11:11:54Z</dc:date>
    <item>
      <title>Unpack json-like string</title>
      <link>https://community.qlik.com/t5/App-Development/Unpack-json-like-string/m-p/2490129#M101897</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I have a json-like string in a field in a loaded table. As you can see it has a lot of whitespace and new line characters in it which probably doesn't help. It also differ a bit between what is in the different sections {}&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[{
        "UID": 1,
        "Date": "Jun 23, 2021",
        "isActiveChannel": true,
        "IsConnected": false,
        "isEndInventory": false,
        "IsHeader": true,
        "IsOpenInventory": false,
        "isCalculatedActual": false
},{
      "UID": 10,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": false,
      "isEndInventory": false,
      "IsHeader": false,
      "IsOpenInventory": true,
      "isCalculatedActual": false,
      "StoragePointUID": 309,"ValuePlanned": 0,"Value": 0},{
      "UID": 2,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": true,
      "isEndInventory": false,
      "IsHeader": false,
      "IsOpenInventory": false,
      "isCalculatedActual": false,
      "StoragePointUID": 309,
      "ChannelName": "EFC1",
      "ChannelType": "Storage",
      "ChannelUID": 753,
	"IOChannel": "Incoming"},{
      "UID": 3,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": true,
      "isEndInventory": false,
      "IsHeader": false,
      "IsOpenInventory": false,
      "isCalculatedActual": false,
      "StoragePointUID": 309,
      "ChannelName": "EFC2",
      "ChannelType": "Storage",
      "ChannelUID": 761,
	"IOChannel": "Incoming"},{
      "UID": 4,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": false,
      "isEndInventory": false,
      "IsHeader": false,
      "IsOpenInventory": false,
      "isCalculatedActual": false,
      "StoragePointUID": 309,
      "ChannelName": "Local",
      "ChannelType": "Manual",
      "ChannelUID": 755,
	"IOChannel": "Outgoing"},{
      "UID": 5,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": false,
      "isEndInventory": false,
      "IsHeader": false,
      "IsOpenInventory": false,
      "isCalculatedActual": false,
      "StoragePointUID": 309,
      "ChannelName": "",
      "ChannelType": "Manual",
      "ChannelUID": 763,
	"IOChannel": "Outgoing"},{
      "UID": 6,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": false,
      "isEndInventory": false,
      "IsHeader": false,
      "IsOpenInventory": false,
      "isCalculatedActual": false,
      "StoragePointUID": 309,
      "ChannelName": "Export",
      "ChannelType": "Manual",
      "ChannelUID": 765,
	"IOChannel": "Outgoing"},{
      "UID": 7,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": true,
      "isEndInventory": false,
      "IsHeader": false,
      "IsOpenInventory": false,
      "isCalculatedActual": false,
      "StoragePointUID": 309,
      "ChannelName": "Off spec",
      "ChannelType": "Storage",
      "ChannelUID": 773,
	"IOChannel": "Outgoing"},{
      "UID": 8,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": true,
      "isEndInventory": false,
      "IsHeader": false,
      "IsOpenInventory": false,
      "isCalculatedActual": false,
      "StoragePointUID": 309,
      "ChannelName": "Damietta",
      "ChannelType": "Storage",
      "ChannelUID": 779,
	"IOChannel": "Outgoing"},{
      "UID": 9,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": true,
      "isEndInventory": false,
      "IsHeader": false,
      "IsOpenInventory": false,
      "isCalculatedActual": false,
      "StoragePointUID": 309,
      "ChannelName": "Adabiya",
      "ChannelType": "Storage",
      "ChannelUID": 907,
	"IOChannel": "Outgoing","ValueActual": 5000.00000000},{
      "UID": 11,
      "Date": "Jun 23, 2021",
      "isActiveChannel": true,
      "IsConnected": false,
      "isEndInventory": true,
      "IsHeader": false,
      "IsOpenInventory": false,
      "isCalculatedActual": false,
      "StoragePointUID": 309,"ValuePlanned": -5000.00000000}]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I found the post with &lt;A href="https://community.qlik.com/t5/Design/FROM-FIELD-Is-very-powerful-It-helped-me-parse-JSON-data-stored/ba-p/2076344#comments" target="_self"&gt;From_Field&lt;/A&gt; and have tried it out with some different twists. They all kind of ends up in either of two ways, either there is no data in fields or I get a lot of synthetic keys and the load fails.&lt;BR /&gt;&lt;BR /&gt;My last try was to split up the string into sections like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Mere_Json:
 Load
 [Index],
 PurgeChar(Subfield(Replace([Json], '},{', '},,,,{'), ',,,,'), '[]') as StringJson
Resident TableWithJson
;

drop table TableWithJson;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;and then try to use From_Field&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;json_days:
load *
From_Field (Mere_Json, StringJson)(json, utf8, no labels);

STORE json_days INTO [:MyJsonList.qvd](qvd);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;It doesn't go well.&lt;BR /&gt;&lt;BR /&gt;Do any of you have any great ideas how this might be done?&lt;BR /&gt;Can I temporarily turn of the synthetic key creation part?&lt;BR /&gt;Am I doing anything obviously wrong?&lt;BR /&gt;&lt;BR /&gt;Should this somehow be solved with a inline load since I kind of have the structure for the string?&lt;BR /&gt;&lt;BR /&gt;Kind regards&lt;BR /&gt;Johan&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 11:11:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Unpack-json-like-string/m-p/2490129#M101897</guid>
      <dc:creator>_Johan</dc:creator>
      <dc:date>2024-10-31T11:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Unpack json-like string</title>
      <link>https://community.qlik.com/t5/App-Development/Unpack-json-like-string/m-p/2492750#M102231</link>
      <description>&lt;P&gt;After some trials and testing I have found a way which unpacks the data into a table.&lt;BR /&gt;If I concatenate the load with From_Field all syntetic keys are avoided and the unpacking is quite fast, comparably at least.&lt;BR /&gt;&lt;BR /&gt;Code:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NoConcatenate
Mere_Json:
Load Json
Resident TableWithJson;
drop table TableWithJson;

New_Json:
load
*
inline 
[Date];


Concatenate Load *
From_Field (Mere_Json, Json)(json, utf8, no labels);&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;An interesting part here is that I only provide one column name, "Date", in the table and still all the rest are filled in properly.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 12:59:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Unpack-json-like-string/m-p/2492750#M102231</guid>
      <dc:creator>_Johan</dc:creator>
      <dc:date>2024-11-14T12:59:39Z</dc:date>
    </item>
  </channel>
</rss>

