Keyword

0 Error decoding JSON data: Syntax Error

More
1 year 11 months ago #158910 by Zoe
Zoe created the topic: 0 Error decoding JSON data: Syntax Error
Hello,

I have recently upgraded Joomla! to 3.6.4 and now I get the above error (0 Error decoding JSON data: Syntax Error) on a number of K2 items while on others I don't.

I have tried resetting the parameters as discussed on issues.joomla.org/tracker/joomla-cms/12460 - I have removed the Editor and JB Library is not installed. I still get the same error.

0 Error decoding JSON data: Syntax error
Call stack
# Function Location
1 JApplicationCms->execute() /[path]/administrator/index.php:51
2 JApplicationAdministrator->doExecute() /[path]/libraries/cms/application/cms.php:261
3 JApplicationAdministrator->dispatch() /[path]/libraries/cms/application/administrator.php:152
4 JComponentHelper::renderComponent() /[path]/libraries/cms/application/administrator.php:98
5 JComponentHelper::executeComponent() /[path]/libraries/cms/component/helper.php:380
6 require_once() /[path]l/libraries/cms/component/helper.php:405
7 JControllerLegacy->execute() /[path]/administrator/components/com_k2/k2.php:147
8 K2ControllerItem->display() /[path]/libraries/legacy/controller/legacy.php:702
9 K2Controller->display() /[path]/administrator/components/com_k2/controllers/item.php:21
10 JControllerLegacy->display() /[path]/administrator/components/com_k2/controllers/controller.php:20
11 K2ViewItem->display() /[path]/libraries/legacy/controller/legacy.php:664
12 Joomla\Registry\Registry->__construct() /[path]administrator/components/com_k2/views/item/view.html.php:466
13 Joomla\Registry\Registry->loadString() /[path]/libraries/vendor/joomla/registry/src/Registry.php:72
14 Joomla\Registry\Format\Json->stringToObject() /[path]/libraries/vendor/joomla/registry/src/Registry.php:366

Please help.

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #158917 by Krikor Boghossian
Krikor Boghossian replied the topic: 0 Error decoding JSON data: Syntax Error
Hello,

This is a core Joomla! issue, a lot of sources for this error.
There are several solutions posted online, I think one from Joomlashack was the most thorough.

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago - 1 year 11 months ago #158929 by Zoe
Zoe replied the topic: 0 Error decoding JSON data: Syntax Error
Hello Krikor,

Thanks for the link to the JoomlaShack topic, I checked it. update [prefix]_modules set params="" WHERE params = "{"\"\"}";
is the first thing I did. I got a return of 0 rows updated.

I saw further down in the Github conversation that it was argued this is not a Joomla core issue and it is an extensions issue to do with the extensions not being able to handle this higher level of error handling, if I've understood it correctly.

I have also implemented the #116713 solution and defined the following in the top of my index.php file:

unset($this->_scripts[JURI::root(true).'/components/com_k2/js/k2.js?v2.7.1&sitepath='.JURI::root(true).'/']);

And I'm still getting the error. I thought disabling the javascript would resolve the JSON error? Am I wrong?

I have currently resorted to deleting the old K2 items and replacing them with new ones (after copying the content directly out from the SQL) this works but it is far from an ideal solution.

Any ideas?
Last Edit: 1 year 11 months ago by Zoe. Reason: updated k2.js version in line of code

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #158930 by Krikor Boghossian
Krikor Boghossian replied the topic: 0 Error decoding JSON data: Syntax Error
The unsetting of a JS script is a frontend issue, it won't affect any aspect of data stored in the db.

The item's params are stored in JSON format.
If removing an item solves the issue, then you might have located the culprit.

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

Please Log in or Create an account to join the conversation.

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Extensions Developer
More
1 year 11 months ago #159082 by Mohamed Abdelaziz
Mohamed Abdelaziz replied the topic: 0 Error decoding JSON data: Syntax Error
Hello All,

I've found this issue while I'm editing some K2 items, after upgrading to Joomla 3.6.4
After some debugging on my personal website, I fixed this issue by hacking the file /administrator/components/com_k2/views/item/view.html.php
I replaced this statement:
FilterOutput::objectHTMLSafe($item, ENT_QUOTES, array(
			'video',
			'params',
			'plugins'
		));

With this one:
FilterOutput::objectHTMLSafe($item, ENT_QUOTES, array(
			'video',
			'params',
			'plugins',
                        'metadata'
		));

You can give it a try, may be it fix your issue.

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #159091 by smarterweb
smarterweb replied the topic: 0 Error decoding JSON data: Syntax Error
we had the same issue, but only after importing Joomla articles into K2. Seems there is leftover metadata that creates the problem.
A solution is to clear the column "metadata" in k2 table "k2_items" here's the sql query:

UPDATE `tableprefix_k2_items` SET `metadata` = ''

NOTE: You will of course loose your metadata if there was any.

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago - 1 year 11 months ago #159096 by Zoe
Zoe replied the topic: SOLVED: 0 Error decoding JSON data: Syntax Error
I had kept a few non-working articles to test a fix and yours worked.
Where Joomla articles had been imported, the metadata was showing:
{"robots":"","author":"","rights":"","xreference":....

Where I had recreated articles in K2 after the upgrade, the same metadata was showing:
robots=
author=

Now that I have cleared that field, I can now access the old articles!

Thank you smarterweb!
Last Edit: 1 year 11 months ago by Zoe.

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #159097 by Zoe
Zoe replied the topic: 0 Error decoding JSON data: Syntax Error
Hello Mohamed, I went looking for the line you quoted and couldn't find it but it was definitely a problem with the metadata. Thanks!

Please Log in or Create an account to join the conversation.

More
1 year 11 months ago #159101 by Krikor Boghossian
Krikor Boghossian replied the topic: 0 Error decoding JSON data: Syntax Error
Hello Mohammed,

Care to make a PR?

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

Please Log in or Create an account to join the conversation.

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Extensions Developer
More
1 year 11 months ago - 1 year 11 months ago #159103 by Mohamed Abdelaziz
Mohamed Abdelaziz replied the topic: 0 Error decoding JSON data: Syntax Error
Hello Krikor,

Yes of course, just wanted to have some more tests from others before the PR.

Can you help in this test?
Last Edit: 1 year 11 months ago by Mohamed Abdelaziz.

Please Log in or Create an account to join the conversation.

Moderators: william white