Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

174
Views
PDFJsAnnotations Uncaught (in promise) SyntaxError: Unexpected end of JSON input

tried to load saved json from local storage using JSON.parse(localStorage.getItem("CanvaData"))

  ready() {
    console.log("Plugin initialized successfully");

    var arr = JSON.parse(localStorage.getItem("CanvaData"));
    console.log(arr)
    // localStorage.clear();
    pdf.loadFromJSON(arr)
  },

but as you can see it's throwing SyntaxError: Unexpected end of JSON input .

how to resolve this issue?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

So after investigating for hours i found the issue that causes this.

i saved the json into local storage as a single string

localStorage.setItem('CanvaData', JSON.stringify(pdf.serializePdf()));

now i changed it to save the data as json to local storage

localStorage.setItem('CanvaData', pdf.serializePdf());

after that i modified the load from json as the following:

ready() {
    console.log("Plugin initialized successfully");

     var data123 = localStorage.getItem('CanvaData');
     pdf.loadFromJSON(JSON.parse(data123))
  },

Fixed.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!