Error decoding JSON data: Syntax error after update to 3.6.3

Need help upgrading your Joomla! website or converting to Joomla! 3.x?

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
User avatar
robwent
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 113
Joined: Tue Jan 26, 2010 11:26 pm
Location: Loughborough, UK
Contact:

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by robwent » Fri Dec 16, 2016 11:04 pm

There's nothing wrong with the code you just posted, so the issue must be elsewhere.

It's not a bug in Joomla, it's an issue with data in your database.

https://github.com/robwent/joomla-json-db-check

User avatar
mlucas77
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Sat Oct 23, 2010 12:24 am

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by mlucas77 » Sat Dec 17, 2016 12:47 am

Does this fix the issue? I dont see what this does except identify your data that might be an issue. My scan is revealing allot of errors? How did it get this way.

User avatar
robwent
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 113
Joined: Tue Jan 26, 2010 11:26 pm
Location: Loughborough, UK
Contact:

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by robwent » Sat Dec 17, 2016 1:03 am

Did you read the instructions?

Loading the script can fix some common errors but you need to check if it's fixed after loading it.

If not then you need to fix the data that shows up in the full check or contact the developers of the extension that is causing the issue.

Buldre
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Tue Nov 10, 2009 2:44 pm

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by Buldre » Sat Dec 17, 2016 9:36 pm

I downloaded the script from robwent and followed his instructions for execution of the script. In just one second, the script modified more than 8000 rows in my database. Then I used the script to check the database for all invalid values, and the script instantly found a few dozen errors, all related to some old banners, as I had already disabled, so I just deleted them. And with these easy grip, I got rid of all the errors related to JSON.

The fix was really simple to perform with this script, and it all could be completed within a few minutes. Totally amazing!

Many thanks to robwent!

User avatar
robwent
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 113
Joined: Tue Jan 26, 2010 11:26 pm
Location: Loughborough, UK
Contact:

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by robwent » Sat Dec 17, 2016 9:39 pm

Thank you sir :)

User avatar
mlucas77
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Sat Oct 23, 2010 12:24 am

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by mlucas77 » Sun Dec 18, 2016 3:42 am

This bug is very frustrating, you say this in the DB, but I cant create a new banner in this sections of Joomla. Why would this keep me from creating a new banner when there is not offending Json script in the params? I think the new version hasnt been tested.

I basically have to rebuild this site from scratch, this is completely unusable. I went back to back up before my 3.4.5, and the issue isnt present. I believe it isnt the code that doesn't allow the script to run. I really need a solution on how fix this issue

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30887
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by Per Yngve Berg » Sun Dec 18, 2016 10:22 am

Why don't you use the patch presented earlier in this thread that prints out the JSON that throws the error? That will make it easier to spot the data with error.

grsamson
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 160
Joined: Thu Dec 31, 2009 12:04 am

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by grsamson » Sun Jan 01, 2017 3:55 am

This error just started with our joomla site. I am not certain which version we are on, and can't log in to check, though some updates were carried out recently.

What's the procedure for fixing this when you can't log in to administrator backend?

thanks
Geoff

User avatar
robwent
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 113
Joined: Tue Jan 26, 2010 11:26 pm
Location: Loughborough, UK
Contact:

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by robwent » Sun Jan 01, 2017 5:54 am

Geoff - try the script mentioned earlier in this thread

Topknotch
Joomla! Apprentice
Joomla! Apprentice
Posts: 45
Joined: Tue Mar 29, 2011 6:28 pm

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by Topknotch » Tue Jan 03, 2017 7:01 pm

ok, I have been using Joomla since the early days of v1.5 and have built many many websites using it.
However it is problems like this that give it a really bad name and enforce people to move to WP!
This thread was started back in October, and there is still no clear fix only a link https://github.com/robwent/joomla-json-db-check that is basically saying 'sort it out yourself!'
When you have many websites that you need to update, this sort of thing is completely unacceptable.
Come on Joomla sort it all out or have I wasted 10 years of my life working on the wrong CMS??

User avatar
robwent
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 113
Joined: Tue Jan 26, 2010 11:26 pm
Location: Loughborough, UK
Contact:

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by robwent » Tue Jan 03, 2017 8:42 pm

Sorry you feel that way, but the issue is not with the cms, it's the data in your database.

I've updated hundreds of sites and not actually run into this issue once.

You can either have invalid data in your database and no proper validation, or you can fix it and use a better cms.

Happy new year!

deleted user

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by deleted user » Tue Jan 03, 2017 8:57 pm

Well, I already offered one fix for core by blissfully removing all data and configuration validations and just letting users hope their sites run right and if there's something busted they'll never be aware of it; that wasn't received very well.

Even if there were a core fix, it would involve data loss. At least right now you still are able to fix a broken column and retain whatever data is stored within it. That could be a user's parameters defining a local language or timezone, or a content item's (article, category, contact, banner, etc.) parameters defining things like whether to link certain data or even display it, or a menu item's configuration which might include hidden menu items, or your template style's parameters, or the ACL configuration making sure some of your content isn't publicly accessible or has restricted editing permissions.

Yes, it is an annoying bug, yes, Joomla blissfully ignored it and things seemingly "worked" before the extra validation was added, but you were most assuredly not getting the expected behavior if the corrupted strings were being processed and now you are aware that there is corrupt data being processed.

User avatar
robwent
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 113
Joined: Tue Jan 26, 2010 11:26 pm
Location: Loughborough, UK
Contact:

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by robwent » Tue Jan 03, 2017 9:01 pm

What Micahel said...

frbrnl
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed Oct 12, 2016 1:45 pm

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by frbrnl » Tue Jan 10, 2017 2:39 pm

Issue occurred for me on version 3.6.5. site when importing joomla articles into K2 items. Front-end display is no problem, back-end editing was not possible. Items newly created in K2 worked fine.

Comparing the data for imported items and new K2 items revealed the issue to be in table K2 items, column 'metadata'.

New items have

Code: Select all

robots= 
author=
data, and imported items have

Code: Select all

{"robots":"","author":"","rights":"","xreference":""}
data in that column.

Modifying the columns of the imported items to

Code: Select all

robots= 
author=
fixed the issue and made the items accessible again in the back-end.

When metadata is edited in back-end it shows up in the column metadata as

Code: Select all

robots=nofollow
author=superuser

User avatar
robwent
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 113
Joined: Tue Jan 26, 2010 11:26 pm
Location: Loughborough, UK
Contact:

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by robwent » Tue Jan 10, 2017 2:44 pm

The imported metadata is valid so this may be a different issue.

kaizendeep
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Mon Feb 08, 2016 4:42 am

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by kaizendeep » Sun Jan 22, 2017 7:46 pm

Running Joomla 3.6.5 here.

"ERROR 0 Page Not Found" is what i get when viewing a page with its menu item pointing to a component. If the said menu item points to an article, then no issues. When i re-point it to a component, the displayed frontend page produces the abovementioned error. However the components themselves work fine.

Switching templates, purging the cache (both system and browser), rebuilding menu links, disabling SEF has no effect.

Running Robwent's script also produced no resolution to the issue. In fact a similar setup is running fine with no issues.

At one point this appeared on the frontend page, but only once:

Error
exception 'RuntimeException' with message 'Error decoding JSON data: Syntax error' in
/home/xxx/public_html/libraries/vendor/joomla/registry/src/Format/Json.php:72 Stack trace: #0
/home/xxx/public_html/libraries/vendor/joomla/registry/src/Registry.php(366): Joomla\Registry\Format\Json->stringToObject('{"menu_image":"...', Array) #1
/home/xxx/public_html/components/com_content/models/article.php(174): Joomla\Registry\Registry->loadString('{"menu_image":"...') #2
/home/xxx/public_html/libraries/legacy/view/legacy.php(408): ContentModelArticle->getItem() #3
/home/xxx/public_html/components/com_content/views/article/view.html.php(42): JViewLegacy->get('Item') #4
/home/xxx/public_html/libraries/legacy/controller/legacy.php(664): ContentViewArticle->display() #5
/home/xxx/public_html/components/com_content/controller.php(113): JControllerLegacy->display(true, Array) #6
/home/xxx/public_html/libraries/legacy/controller/legacy.php(702): ContentController->display() #7
/home/xxx/public_html/components/com_content/content.php(38): JControllerLegacy->execute(NULL) #8
/home/xxx/public_html/libraries/cms/component/helper.php(405): require_once('/home/xxx/...') #9
/home/xxx/public_html/libraries/cms/component/helper.php(380): JComponentHelper::executeComponent('/home/xxx/...') #10
/home/xxx/public_html/libraries/cms/application/site.php(191): JComponentHelper::renderComponent('com_content') #11
/home/xxx/public_html/libraries/cms/application/site.php(230): JApplicationSite->dispatch() #12
/home/xxx/public_html/libraries/cms/application/cms.php(261): JApplicationSite->doExecute() #13
/home/xxx/public_html/index.php(49): JApplicationCms->execute() #14 {main}

I tried this SQL query but no luck either: update `myprefix_menu` set params="" WHERE params = "{\"\"}";

Anything else i can try?

User avatar
robwent
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 113
Joined: Tue Jan 26, 2010 11:26 pm
Location: Loughborough, UK
Contact:

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by robwent » Sun Jan 22, 2017 8:32 pm

"ERROR 0 Page Not Found" is a different error, you should start your own thread.

Try turning off any 3rd party extensions that modify urls like sh404sef. Make sure the item your menu points to is public and published.

I-MAG
Joomla! Guru
Joomla! Guru
Posts: 974
Joined: Sat Oct 14, 2006 5:25 pm
Location: Kuwait

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by I-MAG » Thu Jan 26, 2017 4:28 pm

Update:
For me I discovered that Akeeba Backup was causing the issue. I tried uninstalling it from 2 of my sites, and the problem is gone.
Just in case someone has the same extension, and is still wondering what is the cause of the issue.

starlight
Joomla! Intern
Joomla! Intern
Posts: 72
Joined: Tue Aug 23, 2005 8:07 am

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by starlight » Sat Feb 18, 2017 11:39 pm

I’ve just come across this too, in 3.6.5: whenever I try to go to Global Config or clicking on any “Options” buttons. I’ve run robwent’s script which corrected 100s of items but which didn’t fix my problem. Running the check for invalid values resulted in:

Code: Select all

Checking table: xxxx_extensions, column params
Row 23 is not valid JSON. Error: (Syntax error)
Content: {,"filters":{"1":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"6":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"7":{"filter_type":"NONE","filter_tags":"","filter_attributes":""},"2":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"3":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"4":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"5":{"filter_type":"NONE","filter_tags":"","filter_attributes":""},"8":{"filter_type":"NONE","filter_tags":"","filter_attributes":""}}}
Seeing that row 23 is for com_config, I figure that’s the cause of my problem.

Running the above through JSONLint, the result was:

Code: Select all

Error: Parse error on line 1:
Content: {,	"filter
^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'
If I’ve understood this correctly (which I may well not have), is it that the problem is the comma in-between the first { and “filters”?

If so, would my fix be to delete the comma so that it looks like

{"filters"
instead of
{,"filters"
?

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30887
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by Per Yngve Berg » Sun Feb 19, 2017 7:47 am

Yes it is.

starlight
Joomla! Intern
Joomla! Intern
Posts: 72
Joined: Tue Aug 23, 2005 8:07 am

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by starlight » Sun Feb 19, 2017 12:27 pm

Thanks so much for confirming that, Per :-)

I can now get into Global Config and other Options, which is just as well as it's a test site that was supposed to be offline but wasn't.

earthcub
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Thu Feb 23, 2017 5:20 am

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by earthcub » Thu Feb 23, 2017 8:17 am

I hate the fact that this is my first post to this forum 'cos I usually can always find the solution I need. This is a different case.

This error is happening when a user tries to update their profile. Upon hitting submit, the following error displays:
Error displaying the error page: Application Instantiation Error: Error decoding JSON data: Syntax error

When I track down the user data in the db, each time I find the following associated params field for that user populated with:
{"editor":"","timezone":"","la

Note: I've run robwent's script - https://github.com/robwent/joomla-json-db-check to clean the db until that script returns no offenders.
Note: I've disabled any plugin or component associated with users profiles. User fields as bare bones as possible with the default Basic settings.
Note: magicquotes are Off in both .htaccess and php.ini

In production, I'm running v3.6.5. I "think" the problem began with upgrade from v3.6.2 to v3.6.4. I think I skipped v3.6.3, but my memory's vague at this point.

I began tracking this on a dev server starting from v3.4.1. I cleaned the data in the db with robwent's script. I upgraded to v3.6.2. So far, so go. I can update a profile with no problems. I update to v3.6.5 and the problem is there. I start getting the above json errors instead of being able to update the profile.

So, to me, the problem isn't bad data in the db. In my case, it has something to do with the edit profile submission. If I deliberately change the default settings in the edit profile page, I'll get the following entry in the user table, params field:
{"editor":"jce","timezone":"Am

This is exactly 30 characters, which is the same number of characters that show if I leave the settings at default.

For now, I'm pretty certain that if I just follow muskbh's suggestion and replace the /libraries/ directory from the 3.6.2 update files, things work again because it removes the check in JSON.php and whatever else started this problem.

I've implemented the suggestion here as well to no avail:
https://www.joomlapolis.com/forum/153-p ... or?start=6

Unless I missed something else in this long thread, I think this is a coding issue, not a json validation or data issue.

I've done my due diligence. I'm not looking for a handout. Does anyone truly know what the issue is here?

TIA,
=sean

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30887
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by Per Yngve Berg » Thu Feb 23, 2017 10:11 am

Can you enter a longer string into the database column with phpmyadmin? Maybe the column width is set to short in the database.

PS. Magic quotes is only present in php 5.3, which are with version 5.4 not supported any more. Use php 5.6

deleted user

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by deleted user » Thu Feb 23, 2017 12:45 pm

Check the definition of the database table's columns against the core schema, see https://github.com/joomla/joomla-cms/bl ... .sql#L1861 for the users table. MySQL will truncate the data's length if it is too long for the field type, which my guess is something has caused your users table's params column to have a far too short length.

earthcub
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Thu Feb 23, 2017 5:20 am

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by earthcub » Thu Feb 23, 2017 11:52 pm

Thank you for your response. As I laid in bed last night thinking about this, I came to the same realization and it's true, varchar(30). I checked it. I think if it hadn't been so late, I may have found it before I posted this. Curious if anyone else is having the same problem because I don't know why the params field would've been so small.

jdevinWV
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Wed Feb 01, 2017 7:42 pm

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by jdevinWV » Sat Feb 25, 2017 6:29 pm

CritiKill wrote:
mojito wrote:At the end of the day this code update was bad. They can defend it at a hard limit but there should have been a cleanup or warning or auto resetting of broken fields. I am going to have to take drastic action like this as well. Did you try robert wents script ? I would like to know if anyone did.
https://github.com/robwent/joomla-json-db-check
I tried the script and it worked perfectly. Thanks!
Ditto on the script working.

jimbits
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Tue Jan 22, 2008 6:43 am

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by jimbits » Wed Mar 01, 2017 6:34 pm

infidean wrote:Same problem here

Disabling the JB Library plugin brought my site back up, but I don't think that is a fix.
Thank you for pointing me in the right direction! I updated the plugin (http://www.joomlabamboo.com/joomla-exte ... ery-plugin) and everything worked perfectly.

k12com
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Fri Mar 03, 2017 3:59 am

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by k12com » Fri Mar 03, 2017 4:05 am

frbrnl wrote:Issue occurred for me on version 3.6.5. site when importing joomla articles into K2 items. Front-end display is no problem, back-end editing was not possible. Items newly created in K2 worked fine.

Comparing the data for imported items and new K2 items revealed the issue to be in table K2 items, column 'metadata'.

New items have

Code: Select all

robots= 
author=
data, and imported items have

Code: Select all

{"robots":"","author":"","rights":"","xreference":""}
data in that column.

Modifying the columns of the imported items to

Code: Select all

robots= 
author=
fixed the issue and made the items accessible again in the back-end.

When metadata is edited in back-end it shows up in the column metadata as

Code: Select all

robots=nofollow
author=superuser
Hello.
Could you explain step by step how did you fix it about this?
I am in the same point.
Thanks a lot.

User avatar
conlippert
Joomla! Explorer
Joomla! Explorer
Posts: 481
Joined: Tue Feb 27, 2007 1:53 pm
Location: Ann Arbor, Michigan
Contact:

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by conlippert » Mon Mar 06, 2017 4:19 pm

Hi,
For anyone that needs this...had this JSON problem with a client site and tried the db fix which didn't work. Turned out the metadata column had this in it:

Code: Select all

{"robots":"","author":"","rights":"","xreference":""}
tags=    
which I fixed by replacing with code that looked like this:

Code: Select all

 {"robots":"","author":"","rights":"","xreference":""}
Basically removed the "tags= " code.

Here's the update sql:

Code: Select all

UPDATE `xxxxtes_j32016xxxx`.`iv2am_content` SET `metadata` = '{"robots":"","author":"","rights":"","xreference":""}' WHERE `iv2am_content`.`metadata` = '{"robots":"","author":"","rights":"","xreference":""}
tags=';

User avatar
robwent
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 113
Joined: Tue Jan 26, 2010 11:26 pm
Location: Loughborough, UK
Contact:

Re: Error decoding JSON data: Syntax error after update to 3.6.3

Post by robwent » Tue Mar 07, 2017 10:03 pm

Try the script, which should help you pin down the issue https://github.com/robwent/joomla-json-db-check


Locked

Return to “Migrating and Upgrading to Joomla! 3.x”