Invalid JSON string

Invalid JSON string

Raymond Kersting發表於
Number of replies: 32

Hi!

I have just installed moodle 2.3 CMS to run my course subjects from. We are using a shared hosted linux server for this small site and now that I want to use dropbox to upload my backup files from moodle 1.9+ I am now getting this popup diologue box displaying the following message;

Invalid JSON string

I have tried to fathom out what others were asking related to this but none of it seems to apply as I cannot find the location for any modifications to the shared server.


Can anyone help me sort this out please.

評比平均分數: -
In reply to Raymond Kersting

Re: Invalid JSON string

Davo Smith發表於
Core developers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片

Unless anyone knows exactly what the issue is already, I'd suggest the best way to find out a bit more information is to use your browser's developer tools to find out exactly what is going on.

If you're using Chrome, click on the 'customise' icon (the little wrench thingy), then 'Tools..., Developer Tools'. Then click on the 'Network' tab. Try the upload again and you should see a new entry appear under the network tab - click on this entry, then click on 'Response' at the top and you should see the exact message that was sent to your browser (which was not correctly recognised by the code running in your browser). Copy and paste that message here and someone should be able to help you.

If you're using Firefox instead of Chrome, then search for and install 'Firebug', then follow the above instructions (I think recent versions of Internet Explorer also have developer tools built in, but I rarely use IE, so you'd have to figure that out for yourself).

In reply to Davo Smith

Re: Invalid JSON string

Raymond Kersting發表於

Thank you for this I will give it ago.

In reply to Raymond Kersting

Re: Invalid JSON string

Raymond Kersting發表於

Sorry I tried to upload the upload error script but this site tells me it is too large.

Not sure what to do next.

If I have a small backup file then it works but when it comes to a larger file it will not upload.  Does this help.

In reply to Raymond Kersting

Re: Invalid JSON string

Dan Poltawski發表於

Hi Raymond,

Unfortunately this 'invalid JSON string' is a generic 'there was a problem' error so there could be many different things going on here, so if you can get the actual error then that is really helpful to find the cause of the issue.

If possible its great if you can do the following to try and find the cause of the issue

  • Enable developer debug mode
  • Click ok to the dialogue box, and look at the 'file picker' window. The real error should be displayed there. If you can copy and paste that into a bug report its very helpful.
  • Check the javascript error console for any reported problems

Thanks,

dan

In reply to Dan Poltawski

Re: Invalid JSON string

Raymond Kersting發表於

Thanks Dan I'll give that ago.

In reply to Raymond Kersting

Re: Invalid JSON string

Joan Medlen發表於

Hi.

I have the same problem. 

No matter how many ways I do the Dropbox thing, with API Correctly, I get this:

array(1) {
  ["Failed to connect to 199.47.216.170: Permission denied"]=>
  string(0) ""
}

Not sure what to do about that....
In reply to Joan Medlen

Re: Invalid JSON string

Dan Poltawski發表於
Hi Joan,

It sounds like you need to configure a proxy for your moodle server to get out to the internet.
In reply to Raymond Kersting

Re: Invalid JSON string

Teddy Aprilianto發表於

Hi All,

I got the same messages when tried to search youtube video . I got errors like

 

Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found in /www/moodle/repository/youtube/lib.php on line 109

Warning: simplexml_load_string(): Failed to connect to 2404:6800:4003:803::1008: Network is unreachable in /www/moodle/repository/youtube/lib.php on line 109

Warning: simplexml_load_string(): ^ in /www/moodle/repository/youtube/lib.php on line 109

Notice: Trying to get property of non-object in /www/moodle/repository/youtube/lib.php on line 110

Fatal error: Call to a member function children() on a non-object in /www/moodle/repository/youtube/lib.php on line 110

 

Really appreciate for any suggestions .

Thanks

TA

 

In reply to Teddy Aprilianto

Re: Invalid JSON string

Frédéric Massart ⭐發表於
Core developers的相片 Plugin developers的相片 Testers的相片

Hi Teddy,

someone else reported a similar issue in http://moodle.org/mod/forum/discuss.php?d=173568

Looking at the error report here I wonder if the access to YouTube is blocked by your administrator, could you check that ?

If you beleive this is an issue, please report it on http://tracker.moodle.org

Thanks!

Fred

評比平均分數:Useful (1)
In reply to Frédéric Massart ⭐

Re: Invalid JSON string

John Holmes發表於

Hi Frederic,

Yes I posted in the other forum (and in fact Teddy and I are at the same school).

You may be right.  We are a Google Apps domain but YouTube is not enabled for our Domain, so if we try to log into YouTube, it fails.  However we can browse youtube with no difficulties.

I'm not sure if somehow the module checks for being logged into Google first, as this would definitely cause a failure.

In reply to Raymond Kersting

Re: Invalid JSON string

Nayomie Baihn發表於

 A teacher in our site has sent throught the following message:

"For about 3 weeks now, I have been getting an 'Invalid JSON String' error message each time I upload a file to my WSI Online sites (please see attached screen shot file)

After I clear the error message, it appears that no file has been uploaded, but when I return to my site home page, the file is there. 

However, students are complaining they are having difficulty accessing and printing the files once uploaded.  I don't know if this is related to the error message, but it is a little annoying as everything was working well. This seems to be happening on all of my sites.

Please advise if I am doing something wrong or what I may need to do to stop the error message".

ANy advice you can provide to assist in resolvign this issue woudl be great as I am very new to the administration side of Moodle. I am assuming from reading other posts on thsi forum it is a generic type of error message.

Regards

Nayomie

附件 Invalid_JSON_string_error.png
In reply to Nayomie Baihn

Re: Invalid JSON string

chau chau發表於

Now. I use moodle vision2.0.10

fix error.

add line to .htaccess

php_value auto_append_file none

大笑

評比平均分數:Useful (1)
In reply to chau chau

Re: Invalid JSON string

Steve Bilton發表於

Wow! Very interesting, does this really fix the JSNO String issue?!

That's easy, although I found out a little late as I've already upgraded my moodle to get around this problem.

Thanks

 

Steve

 

In reply to Raymond Kersting

Re: Invalid JSON string

Vladimir Ivanov發表於
I had the same problem after upgrade to moodle 2.3 and had to disable HTTPS (SSL certifiacate) to make it work. I know this is not the best solution but in my case it works
In reply to Vladimir Ivanov

Re: Invalid JSON string

Steve Bilton發表於

Hi,

 

I've just posted here: https://moodle.org/mod/forum/discuss.php?d=215927

It's the same JSON error, but I've worked out it seems to be a file level issue (I think).

please see the post and let me know if this is anything similar to the issues you are all experiencing.

Looks like a moodle BUG to me, if it's a directory level issue.

Trying not to cross post, but here's a brief explaination showing that it appears to be a directory structure level issue.

These paths to files all work. You will notice they are only 1 directory deep.

Path: /mp3/01_Diploma_A1.mp3
Path: /ndip/01_Diploma_A1.mp3
Path: /ndip/02_Diploma_A1.mp3
Path: /videos/A5_Safety_culture.flv  

The below paths DO NOT work - You will notice these paths are all more than 1 directory deep.

Could not get past these directory structure levels. Directories which did not contain files only other directories allowed me to navigate to them. However as soon as I get to where files are store it outputs the error.

  • Using Path:/mp3/UNIT_A/test/
  • Path:/mp3/UNITA/A1/
  • Path:/mp3/ndip/a1/
  • Path: /ndip/a1/
  • Path:/ndip/1/

Does this help anyone troubleshooting this issue?

Obviously I'm looking for a solution too 大笑

Thanks

Steve

In reply to Raymond Kersting

Re: Invalid JSON string

Tony Page發表於

This is an odd workaround but it seems to be good for profile pic changes.  FORGET trying to change your profile pic in the "Edit Profile" section BUT instead go to "My Profile", click on "My Private Files" and upload your pic(s) there FIRST..I've never gotten this JSON error there.

NOW go to the "Edit Profile" and in the File Picker, select Private Files, find the pic you want and it will become your profile pic...no problem!  IMPORTANT-GO TO THE BOTTOM AND CLICK ON UPDATE PROFILE!  Adding multiple pics under Private Files under My Profile first and then you can swap around your profile pic as you see fit.

評比平均分數:Useful (1)
In reply to Raymond Kersting

Re: Invalid JSON string

Tom Collins發表於

Today, I got the dreaded "invalid JSON string" error. I could not find what I though was a credible fix here on the forum but was able to resolve the issue. I simply restarted the server. That seems to have fixed the problem. I run my Moodle site on a VPS hosted by Dreamhost and can restart the server myself from the control panel. Try it. It might work.

In reply to Tom Collins

Re: Invalid JSON string

Andrew Morris發表於

I've enabled repositories as suggest on two Centos (Linux) servers but when I ftp a file up to the relevant folder, no file appears in file picker!

Moodle version is 2.3.4+ and I've changed all the file/folder permissions so it's all under apache and even given it 777 but no luck.

Any ideas?

附件 FP-1.JPG
In reply to Andrew Morris

Re: Invalid JSON string

Ken Task發表於
Particularly helpful Moodlers的相片

@Andrew ... Uhhh, you're not getting 'Invalid JSON string' so this posting should have been a new one.  But ... a question for ya ...

the folder/directory for 'Test' you created has what ownership/permissions on it?

How about the 'repository' directory itself?

Does your apache error logs show anything related?

'spirit of sharing', Ken

In reply to Ken Task

Re: Invalid JSON string

Andrew Morris發表於

Ken - I've found a fix! Upgarde to 2.3.4.

You do have to change all the permissions so the owner and group is apache:apache.

Thanks for replying! I thought I would be talking to myself!

In reply to Raymond Kersting

Re: Invalid JSON string

Brian Carpenter發表於

I will leave this for future googlers... 

This issue cropped up once I moved login to HTTPS. The page loaded in http but tries to pull yui libraries as HTTPS://<your server>/.....  

Which does not work.

Changing the address bar to https://  worked.

 

評比平均分數:Useful (1)
In reply to Brian Carpenter

Re: Invalid JSON string

Matteo Scaramuccia發表於

Hi Brian,
thanks for sharing it!

Would you mind to file an issue into the Moodle Tracker describing the context, as done here, in which the issue comes up and the workaround? It sounds to me as a bug that need a bit of investigation, and a fix, since HTTPS is required, YUI included (guessing you're using the external bundle), only during the Moodle login process.

TIA,
Matteo

In reply to Matteo Scaramuccia

Re: Invalid JSON string

sana basheer發表於

Hello everyone,

When i am uploading a scorm package 1.2 on moodle 2.4 i am getting this error  i dont know how to fix this.Can anyone help me.

Thanks in advance

Invalid JSON string

 

FastCGI Error 
The FastCGI Handler was unable to process the request. 
 
Error Details: 
 
The FastCGI process exceeded configured request timeout
Error Number: 995 (0x800703e3). 
Error Description: The I/O operation has been aborted because of either a thread exit or an application request.
 
 
 
HTTP Error 500 - Server Error.Internet Information Services (IIS) 

 
In reply to sana basheer

Re: Invalid JSON string

Richard Oelmann發表於
Core developers的相片 Plugin developers的相片 Testers的相片

It looks as if you need to look at the Fast-CGI time-out settings on your IIS server as the issue appearrs to be there rather than with Moodle. You will need to speak to whoever manages your server for you to get this value increased.

The most common cause of the error is file upload sizes, but in your case the error message is telling you its FastCGI timeouts

Richard

In reply to Richard Oelmann

Re: Invalid JSON string

Wen Hao Chuang發表於

Just a quick FYI. I got this error message ("Invalid JSON string") too when I was trying to upload a course backup file (16MB) to restore it. I turned on the debugging mode and couldn't find anything. Then I reduced the size of the course backup file to 12MB, this time it's showing me a different error message: "The uploaded file may exceed the post_max_size directive in php.ini." I'm running 2.4.6.

Wen

評比平均分數:Useful (1)
In reply to Wen Hao Chuang

Re: Invalid JSON string

Richard Oelmann發表於
Core developers的相片 Plugin developers的相片 Testers的相片

Again, this looks like you will need to get your system administrator to check the php settings on your server.

In reply to Richard Oelmann

Re: Invalid JSON string

Crescenciano Olvera發表於

Hi everybody,

I have the Invalid JSON string problem, is in apache 2.5 moodle version, when I updeted to 2.5 I have the same problem, after looking moodle forums, it was solved add the next line to my .htaccess file:

suPHP_ConfigPath /home/XXXX/public_html

where XXXX is my site username

I was working fine for about 4 months, but yesterday I have the same Invalid JSON string problem, I am working with Firefox Mozilla with activated the firebug, and the message is as follows:

<!DOCTYPE html>
<html id="yui_3_9_1_2_1397394788837_1046" class="yui3-js-enabled" lang="es-mx" xml:lang="es-mx" dir="ltr">
<div id="yui3-css-stamp" class="" style="position: absolute !important; visibility: hidden !important"></div>
<head>
<body id="page-course-edit" class="format-topics path-course gecko dir-ltr lang-es_mx yui-skin-sam yui3-skin-sam integralesa-com--e-Learning pagelayout-admin course-16 context-399 category-6 editing side-pre-only jsenabled dndsupported">
<div id="yui_3_9_1_2_1397394788837_637" class="yui3-dd-proxy" style="position: absolute; display: none; z-index: 999; top: -999px; left: -999px;"></div>
<div id="yui_3_9_1_2_1397394788837_602" class="yui3-dd-shim" style="top: 0px; left: 0px; position: absolute; z-index: 9999; overflow: hidden; background-color: red; display: none; height: 5px; width: 5px;">
<div class="skiplinks">
<script type="text/javascript">
<div id="page">
<div class="clearfix"></div>
<script type="text/javascript">
<script type="text/javascript">
<script type="text/javascript">
<script type="text/javascript">
<div id="dateselector-calendar-panel" class="yui3-widget yui3-overlay yui3-widget-positioned yui3-widget-stacked yui3-overlay-hidden" style="left: 0px; top: 0.616669px;">
<div id="dock" class="dock dock_left_vertical nothingdocked" role="menubar">
<div style="display: none;"></div>
<div id="filesskin">
</body>
 
I will appreciate any advice to solve it, please be pattience with my little knowing about this issues,
 
thank you in advance for your help,
 
Olvera
In reply to Crescenciano Olvera

Re: Invalid JSON string

Music Technician發表於

Hi there,

This is the code for the error I am having. I am uploading a PDF file and other PDF's have been uploading fine before and after the error.

Any ideas welcome!


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>

<title>404 - File or directory not found.</title>

<style type="text/css">

<!--

body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}

fieldset{padding:0 15px 10px 15px;} 

h1{font-size:2.4em;margin:0;color:#FFF;}

h2{font-size:1.7em;margin:0;color:#CC0000;} 

h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} 

#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;

background-color:#555555;}

#content{margin:0 0 0 2%;position:relative;}

.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}

-->

</style>

</head>

<body>

<div id="header"><h1>Server Error</h1></div>

<div id="content">

 <div class="content-container"><fieldset>

  <h2>404 - File or directory not found.</h2>

  <h3>The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.</h3>

 </fieldset></div>

</div>

</body>

</html>


In reply to Brian Carpenter

Re: Invalid JSON string

Jim Martin發表於

I hate to jump on an old thread but just wanted to add that this (switching the entire site to HTTPS) helped me resolve this issue too. 

I upgraded from Moodle 2.5 to (both 2.6 and 2.7) and ran into this issue, immediately any time a page with a Filepicker was involved.  Additionally, I was having a problem with the Site Administration links menu not loading.  Switching the entire site to HTTPS ($CFG->wwwroot   = "https://<your moodle site address>") helped.

Thank you Brian Carpenter for pointing this fix out.

Jim