Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
MAnywar
Contributor III
Contributor III

tExtractJSONField : Premature end of file error.

I have am trying to extract fields from a json string: but I keep getting the error: Error on line 1 of document : Premature end of file.

{

"PAT_ID":null,"MPI":null,"ACCESSION_NO":"RAD-2022-","SERIES_IUID":"1.3.12.2.1107","SERIES_DESC":"T1_VIBE_DIXON_TRA_OPP","NUM_INSTANCES":"544678","STUDY_IUID":"2.20266.966.819132811","STUDY_DATETIME":"2022-09-22","SRC_AET":"ACHIEVA2","MODALITY":"MR","BODY_PART":"WHOLEBODY","LATERALITY":"098","POTID":"KK"

}

I tried replacing the nulls with some values but I get the same error.

I also tried to just work with only one field: {"PAT_ID":"993"}. But I get the same error. Any help is highly be appreciated. Thank you.

Screenshot of the reading part of the job.

0695b00000Z2GhjAAF.png

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi

I just validate your json string on site and confirm that it is a valid json string, i use a tFileInputJson to read the json file and it works.

0695b00000Z2IpGAAV.png0695b00000Z2IpQAAV.pngCan you share a screenshot of the basic settings of tExtactJsonFields?

 

Regards

Shong

View solution in original post

4 Replies
Anonymous
Not applicable

Hi

I just validate your json string on site and confirm that it is a valid json string, i use a tFileInputJson to read the json file and it works.

0695b00000Z2IpGAAV.png0695b00000Z2IpQAAV.pngCan you share a screenshot of the basic settings of tExtactJsonFields?

 

Regards

Shong

MAnywar
Contributor III
Contributor III
Author

Yes, you are right. when I use tFileJson, the file is read. but when I use tExtract, it fails because I was saying ready by Xpath instead of Jsonpath. After changing to Read by Jsonpath, all is being read now.

Thanks a bunch!

 

0695b00000Z2KBrAAN.png 

Anonymous
Not applicable

Great, thanks for your feedback!

MAnywar
Contributor III
Contributor III
Author

Hello team,

I did not want to create a 2nd issue but this is kind of similar; I have a problem with reading loops in a string.

I tried converting the data from xml to json hoping there will be some change, but i have not been successful..

Attached is screenshot of part of the job doing the above.

 

0695b00000Z3GiyAAF.pngSo I have I would like to extract:

Medication/code/coding/code/@value,

Medication/ingredient/extension/valueCoding/code/@value,

Medication/ingredient/itemCodeableConcept/coding/display/@value

All these have varying number of times they can loop. On one document, they could just appear once. On another probably 10 time. I cannot tel how many times each appear.

I will be grateful for any help or advise,

Here is my sample data:

<Medication xmlns="http://hl7.org/fhir">

 <id value="Medication/193940"/>

<identifier>

 <value value="89096"/>

</identifier>

<code>

 <coding>

  <system value="http://fhir.de/CodeSystem/dimdi/atc"/>

  <code value="C07AB07"/>

  <display value="ATC: C07AB07 - Bisoprolol-ratiopharm 5mg(Bisoprololhemifumarat, 5 MG, TAB)"/>

 </coding>

 <coding>

  <system value="http://fhir.de/CodeSystem/ifa/pzn"/>

  <code value="6865965"/>

  <display value="PZN: 6865965 - Bisoprolol-ratiopharm 5mg(Bisoprololhemifumarat, 5 MG, TAB)"/>

 </coding>

 <text value="Bisoprolol-ratiopharm 5mg(Bisoprololhemifumarat, 5 MG, TAB)"/>

</code>

<status value="active"/>

<form>

 <coding>

  <system value="https:/"/>

  <code value="TAB"/>

 </coding>

</form>

<ingredient>

 <extension url="https://">

  <valueCoding>

   <system value="https://"/>

   <code value="PIN"/>

   <display value="precise ingredient"/>

  </valueCoding>

 </extension>

 <itemCodeableConcept>

  <coding>

   <display value="Bisoprololhemifumarat"/>

  </coding>

 </itemCodeableConcept>

 <isActive value="true"/>

 <strength>

  <numerator>

   <value value="5.0"/>

   <unit value="5.0MG"/>

   <system value="http://unitsofmeasure.org"/>

   <code value="{MG}"/>

  </numerator>

  <denominator>

   <value value="1"/>

   <unit value="1{Stueck}"/>

   <system value="http://unitsofmeasure.org"/>

   <code value="{Stueck}"/>

  </denominator>

 </strength>

</ingredient>

<ingredient>

 <extension url="https://www.">

  <valueCoding>

   <system value="https://www"/>

   <code value="IN"/>

   <display value="Ingredient"/>

  </valueCoding>

 </extension>

 <itemCodeableConcept>

  <coding>

   <display value="Bisoprolol"/>

  </coding>

 </itemCodeableConcept>

 <isActive value="true"/>

 <strength>

  <numerator>

   <value value="4.24"/>

   <unit value="4.24MG"/>

   <system value="http://unitsofmeasure.org"/>

   <code value="{MG}"/>

  </numerator>

  <denominator>

   <value value="1"/>

   <unit value="1{Stueck}"/>

   <system value="http://unitsofmeasure.org"/>

   <code value="{Stueck}"/>

  </denominator>

 </strength>

</ingredient>

</Medication>