Got Error decoding JSON data: Syntax error while accessing elements

Hello,

I just updated from Joomla 3.6.3 to 3.6.4 and now I got a message "Error decoding JSON data: Syntax error" when I want to access the elements management board at the back end.

error_Json.JPG
All the other menus of the Fabrik component are working.

Database Version 5.5.52-cll
Database Collation utf8_unicode_ci
Database Connection Collation utf8mb4_general_ci
PHP Version 5.6.23
Web Server Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4
WebServer to PHP Interface cgi-fcgi
Joomla! Version Joomla! 3.6.4 Stable [ Noether ] 21-October-2016 16:33 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2901.4 Safari/537.36

Please help!

Thank you
 
Thank you for coming back to me.
M'y Fabrik version is 3.5.1.
When I click on the list menu, is it working just fine. However, in the meantime, I noticed that when I try to open one of my list, I get the same error. And then, when I click on the elements menu, while this list is selected, I get the screen I displayed in my previous post.
 
I think this may be an issue I ran across a week or two ago.

In some recent release, J! added throwing an exception in their table handling if the 'params' field (which is in JSON format) cannot be parsed as valid JSON.

Do you have any element calculations (sum, count, etc) on any of the elements in the affected list? I noticed on another user's site recently that there is a specific setup of calculations which can cause a massively long string to be written into the params field in the main xxx_fabrik_elements table, which exceeds the maximum 64kb size of the field, which then breaks the JSON.

You'll need to look in something like phpMyAdmin (or whatever MySQL client you use), and run this SQL by hand:

Code:
select *, char_length(params) as len from xxx_fabrik_elements order by char_length(params) desc

replace xxx with your J! table prefix.

That should sort your elements table by the length of the 'params' field. Have a look at the 'len', and see if any of your elements are 65535 bytes long.

Let me know.

-- hugh
 
Great! The result after I run this script in PHPMyAdmin is that I found 3 elements on the top of the table that fit your description (see screen shot below)
parems.JPG
  • ID 1683 is a calc element
  • ID 1692 is a field decimal
  • ID 1691 is a field decimal
Now, I can access my list again but no PK is to find as you could see below.

no id.JPG
I have to mention also that this list is just a copy of another list that currently works as I needed a different view for different users.

However, the issue still remains when I go to elements' management and select the form in question. I immediately got the Json error message. So I have to log out and log in again to be able to access the elements' management.

select.JPG
 
Last edited:
OK.

You'll need to fix the params on those elements.

In the 'params' field for the affected elements, the last few params should look something like this:

Code:
"join_val_column_concat":null,"sum_value_serialized":"a:1:{s:4:\"calc\";O:8:\"stdClass\":4:{s:5:\"value\";s:9:\"49,627.00\";s:5:\"label\";s:0:\"\";s:7:\"elLabel\";s:7:\"Number \";s:8:\"calLabel\";s:3:\"Sum\";}}","sum_value":"<ul class=\"fabrikRepeatData\">\n<li><span class=\"calclabel\">Sum<\/span>\n49,627.00<\/li>\n<\/ul>"}

But what you will find is that the "sum_value_serialized" is extremely long, and gets chopped off at the end. So what you need to do is remove it, so that your 'params' field ends like this:

Code:
"join_val_column_concat":null}

So basically delete everything after the "join_val_column_concat":null and add a closing }.

Note that it might not be "sum_value_serialized", it might be "avg_value_serialized", or "count_value_serialized", but the same principle applies.

Once you've done that for the affected elements, you should then be able to load your element list again.

Then you need to edit those three elements in Fabrik, and make sure that you have not set the "Split on" for any calculations to be the same element the calc is on, or any other element which may have a lot of different values in your data.

The problem is, that the "Split on" is a way of "grouping" element calculations. So the "serialized" value will have a calculation in it for every different value of the "Split on". It's intended for grouping calculations by a few values ... like "gender" (male/female), or half a dozen departments, or something like that. It wasn't intended to hold thousands of different "splits".

I added some code to github last week which will prevent calculations being stored if the serialized value is too long, so moving forward, this problem shouldn't happen again.

-- hugh
 
Thank you for the straight forward explanation. ;)

However, in the meantime, I managed to reach the elements' management board by clicking at the menu "List", going through the tab "View details" and then by clicking at the 3 elements which exceed the maximum 64kb size. I could open and save those elements. Now I can access all elements again. The issue seems to have solved.
When I came back to MyAdmin and tried again to search for those elements, they had vanished.new_para.JPG

I attached the params' details of the id 1683 and I would like to know if I still have to remove what comes after "join_val_column_concat":null}? For your information, no "Split on" was set up before the issue on any of those 3 elements.

The only issue I have now is that the list does not display the primary key and no data is displayed. I suppose something has been corrupted in the process. Also, I did another copy of this list which works fine. o_O
 

Attachments

  • 1683_param.txt
    6.2 KB · Views: 248
Hmmm. Wish we could have seen what those params were before they got rewritten.

No, you don't have to edit those params. Saving the elements did that for you.

When you say "the list does not display the primary key" do you mean it isn't set in the list settings?

-- hugh
 
Phew! Happy no to have to tinker the code . Yes indeed, I meant the Pk in the list settings as I mentioned it in my third post above with a screen shot.
 
Hmm, that dropdown should show any published elements of type 'internalid' or 'field'.

Can you check the elements, make sure you still have an 'id' of type 'internalid' (or field) pubished?

-- hugh
 
I'm really not sure why it wouldn't show up in the PK dropdown.

But as this is a copy of a list, I'd suggest you just delete it (remember NOT to select "drop table" when you empty the trash) and recreate it. Who knows what else may have gotten damaged.

-- hugh
 
Sorry I couldn't be of more help. On the bright side, once you update from github, we have code in place to prevent this from happening again.

-- hugh
 
Hello,

Unfortunately, I come back to the same issue again, but this time, it happens to the main list, not the copied one and my trick did not work. So I tried to remove everything after join_val_column_concat":null and place a } after null with no success.
In attachment is what I had before clicking on the culprit elements of the list (under view details).

I just did an update from Github but it didn't solve the issue. Please help:(
 

Attachments

  • id_1683.txt
    64 KB · Views: 222
  • id_1691.txt
    64 KB · Views: 227
  • id_1692.txt
    64 KB · Views: 204
Last edited:
Well I did say "once you update from github, we have code in place to prevent this from happening again.". You didn't update, and it happened again. Updating after it happened is like shutting the stable door after the horse has bolted.

You'll have to follow the instructions I gave before:

http://fabrikar.com/forums/index.ph...r-while-accessing-elements.45394/#post-233890

... and remove that excessively long sum_value_serialized param by hand.

-- hugh
 
Thank you for your reply. :oops::oops:

I did remove the long sum_value_serialized param of the 3 items by hand before updating and still have no success. :confused:
So far, I can open and save element id 1683 and id 1691 but not id 1692 when I click on the linked elements of the form. The result is when I try to view all the elements of this form, the whole elements mangement dashboard crashes. Any idea why?
 
Last edited:
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top