WordPress.org

Forums

Loco Translate
[resolved] Error: JSON.parse: unexpected character at line 1 column 1 of the (6 posts)

  1. lzm_dev
    Member
    Posted 1 year ago #

    As i'm saving an edited translation Loco outputs this error message:

    Error: JSON.parse: unexpected character at line 1 column 1 of the JSON data

    Any suggestion how to get rid of this error?

    https://wordpress.org/plugins/loco-translate/

  2. timwhitlock
    Member
    Plugin Author

    Posted 1 year ago #

    Sounds like the response is not JSON, so probably a PHP error.
    I need to see the output of the response to have any idea what is wrong. Use your browser dev tools network inspector, and please post the response from the Ajax call.

  3. timwhitlock
    Member
    Plugin Author

    Posted 1 year ago #

    Do you have any further information, so I can look at this bug?

    Please note a new version has been published since this ticket was opened (1.4.6)

  4. damosresultados
    Member
    Posted 8 months ago #

    Hi, when I try to save or Sync I received the same JSON message, then I removed the plugin and reinstalled, now I'm receiving this:

    Error: SyntaxError: Unexpected token <

    Here the ajax debug when save

    XHR Loaded (admin-ajax.php - 200 OK - 3.330659866333008s - 737B) VM218:3
    http://carnivorosanonimosor.ipage.com/canonimos151/wp-admin/admin-ajax.php?…languages%2Fes_ES.po&action=loco-posave&name=excarnivoros-child&type=theme VM219:3
    Time over 1000ms VM220:3
    Object {startedDateTime: "2014-11-10T04:05:56.257Z", time: 3330.659866333008, request: Object, response: Object, cache: Object…} VM221:3
    XHR Loaded (admin-ajax.php - 200 OK - 1.4817299842834473s - 671B) VM224:3
    http://carnivorosanonimosor.ipage.com/canonimos151/wp-admin/admin-ajax.php?…5a4&action=heartbeat&screen_id=toplevel_page_loco-translate&has_focus=true VM225:3
    Time over 1000ms VM226:3
    Object {startedDateTime: "2014-11-10T04:06:15.405Z", time: 1481.7299842834473, request: Object, response: Object, cache: Object…} VM227:3

    Here the ajax debug when sync

    Consider using 'dppx' units, as in CSS 'dpi' means dots-per-CSS-inch, not dots-per-physical-inch, so does not correspond to the actual 'dpi' of a screen. In media query expression: print, not all, (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) admin.php?name=excarnivoros-child&type=theme&poedit=themes%2Fexcarnivoros-child%2Flanguages%2Fes_ES…:1
    Resource interpreted as Document but transferred with MIME type image/gif: "chrome-extension://hlngmmdolgbdnnimbmblfhhndibdipaf/images/loader.gif". jquery.min.js:17
    XHR Loaded (admin-ajax.php - 200 OK - 2.010580062866211s - 49.896KB) VM396:3
    http://carnivorosanonimosor.ipage.com/canonimos151/wp-admin/admin-ajax.php?…languages%2Fes_ES.po&action=loco-posync&name=excarnivoros-child&type=theme VM398:3
    Time over 1000ms VM399:3
    Object {startedDateTime: "2014-11-10T04:07:34.219Z", time: 2010.580062866211, request: Object, response: Object, cache: Object…} VM400:3

    Thanks

  5. timwhitlock
    Member
    Plugin Author

    Posted 8 months ago #

    One question: Do you have mod_sec enabled on your server? It is known to cause the server to respond with an HTML page instead of the Ajax response.

  6. timwhitlock
    Member
    Plugin Author

    Posted 6 months ago #

    Closing this after two months without follow up to my question.

    A FAQ has been added for this issue here:
    https://wordpress.org/support/topic/faq-what-is-causing-unexpected-tokencharacter-syntax-error

    If the problem persists, please open a new ticket with the required information mentioned in the FAQ.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Loco Translate
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic