We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.

Unterminated string in JSON at position...

Answered
Jonathan Bishop asked on December 6, 2022

Hello, I'm sporatically getting the js console error 'Unterminated string in JSON at position'. But my input is the same. I deal with medical data, so sending raw data is tricky.
I'm using flexmonster/vue-flexmonster 2.9.31 
Check out this video of the problem. Below is the string for the output of 'this.qe' that I reference in the video:

..."mv_a_dur_pv_a_dur":null,"ESTSeg":null,"timezoneId":"America/Los_Angeles","case_delay_reason":null,"'

it just ends there, but according to the network call, the object is complete.
 
I'm calling flexmonster.setReport() with the following configuration.

{"dataSource":{"type":"json","filename":"https://app.encapturemd.com/api/rest/study/studyCache?from=2022-12-04&to=2022-12-07&dedAppVarNames=full_echo%2Cnuclear_cardiology_centric&timestamp=1670337743620&dateField=performed&flatten=true"},"slice":{"rows":[{"uniqueName":"app"},{"uniqueName":"examCodeDescription"}],"columns":[{"uniqueName":"[Measures]"},{"uniqueName":"Nuclear Tech Job"},{"uniqueName":"Technologist Job"}],"measures":[{"uniqueName":"id","aggregation":"distinctcount"}],"expands":{"rows":[{"tuple":["app.[echo]"]},{"tuple":["app.[nuclear cardiology v8]"]}],"columns":[{"tuple":["nuclear tech job.[]"]}]},"flatOrder":["LVEF","LVGeneral","id","app","examCodeDescription"]},"options":{"grid":{"showTotals":"off","showGrandTotals":"off"},"chart":{"activeMeasure":{"uniqueName":{}}},"datePattern":"yyyy-MM-dd","dateTimePattern":"yyyy-MM-dd hh:mm"},"tableSizes":{"columns":[{"tuple":["nuclear tech job.[hhuynh1]"],"measure":{"uniqueName":"id","aggregation":"distinctcount"},"width":142}],"rows":[{"tuple":["app.[echo]","examcodedescription.[]"],"height":31}]},"version":"2.9.31","creationDate":"2022-11-16T17:33:08.009Z"}

7 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster December 7, 2022

Hello, Jonathan,

Thank you for reaching out to us and providing us with the video.

We suggest the workaround using the clear() API call before calling flexmonster.setReport(). It clears the component’s data and view. So that everything should be loaded as expected.

Please let us know if it works for you. Feel free to contact us if other questions arise.

Kind regards,
Nadia

Public
Jonathan Bishop December 7, 2022

Hi Nadia,
Calling clear() did not help. For what it's worth, if I debug/step through the code and after calling setReport() I wait a couple seconds, I don't get the error.  Not sure if this is helpful.  I'm curious if fetching the json myself and set it outside the config will fix the issue.

Public
Jonathan Bishop December 7, 2022

I have not been able to get this working. But I have attached an example input file. It's got a lot (1348) of fields defined. Could that be the problem?
I moved it to fetch the json before and pass it to datasource.data rather than with datasource.filename and it still isn't working. 
 

Attachments:
flexMonster input.json

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster December 8, 2022

Hello, Jonathan,

Thank you for the response and for providing us with the dataset.

We could not reproduce the described issue on our side with your data. However, here are some suggestions:

  1. Could you please remove all the API calls after the setReport() API call? Does this issue appear in such a case?
  2. You can also use the reportcomplete event. It is triggered when data from the report and all data source files are loaded successfully and the grid is rendered. After this event, the operations can be performed with the component. 

Please let us know if those suggestions helped. Looking forward to hearing from you.

Kind regards,
Nadia

Public
Maksym Diachenko Maksym Diachenko Flexmonster December 20, 2022

Hello, Jonathan!

Hope you are doing well.
Our team is wondering if you had time to check the provided solutions.
Please let us know if they were helpful in solving the issue.

Best Regards,
Maksym

Public
Jonathan Bishop December 20, 2022

No, it was still sporatically happening. I should have time next week to dive back into it.

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster January 17, 2023

Hello, Jonathan,

Hope you are doing well.

We were wondering if our response helped you with your question. Have you managed to resolve the issue?

Looking forward to hearing from you.

Kind regards,
Nadia

Please login or Register to Submit Answer