Home > Technical Support > FAQ > Error parsing json, unexpected character

Error parsing json, unexpected character

This article will be useful for administrators of LiveAgent installed on their own servers.

If you encounter the following error

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

it means that instead of JSON response from LiveAgent API, the client application in browser received something that is not JSON. In most cases, it is because the request to API e.g. /api/v3/contacts/ is handled by incorrect index.php file.

If you have mod_rewrite enabled, LiveAgent requests rely on mod_rewrite to process the request URL and /api/v3/contacts/ should be handled by /api/v3/index.php with parameter contacts. However if your mod_rewrite is misconfigured, this request might be handled by the index file in root directory of your installation. Since it doesn't recognize the parameters, it sends as response the customer portal home page HTML. When client application receives the HTML, it fails to process it as it is not a valid JSON format.

To tell mod_rewrite that /api/v3/index.php should handle the request, modify /api/v3/.htaccess and after line

RewriteEngine On

add line 

RewriteBase /api/v3/

This tells the mod_rewrite that all redirects in the file /api/v3/.htaccess should be prepended by /api/v3/ 

Ready to try LiveAgent?

It's free for the first 14 days! No credit card required.

Get Started
We work well with others...
Magento Joomla Wordpress Mailchimp
Contact us

support@ladesk.com

+1-800-811-6590 (Toll Free in USA & Canada)

+421 2 33 456 826 (European Union & Worldwide)

Quality Unit, LLC 616 Corporate Way, Suite 2-3278 Valley Cottage, NY 10989

Stay in touch
Blog Google+
© 2004-2015 QualityUnit.com, All rights reserved