Jump to content

JSON.parse: unexpected character at line 1


Recommended Posts

  • 2 weeks later...

I Don't know how to show ajax call...

It's Network - XHR

clic on + and POST

 

show me

Source

-----------------------------1963530167660 Content-Disposition: form-data; name="legend[1]" P5000S -----------------------------1963530167660 Content-Disposition: form-data; name="file[]"; filename="5128-home_default.jpg" Content-Type: image/jpeg ÿØÿàJFIFÿþ;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 90 ÿÛC ÿÛC ÿÂ"ÿÄ ÿÄÿÚú¤àO·

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

Hi

When trying to upload a miniture in a category i get the message:

 

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

 

How do i fix that

 

Jesper

Hi,

 

It comes from the "categories' block", reinstall it ...

 

regards

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

I also have this message appear when trying to add a jpg to a Category; can't find a fix or any way to upload the file (the file is good, it is selectable to upload, but the error appears when trying to upload). Using v1.6.0.6.

 

Upload fails using either format of png or jpg.

 

This appears to only affect the Category image upload - I can create a new product and add photos to that - I can also add the same file to a Product that will not upload as a Category image.

 

Anyone any ideas what to try?

 

Update: the above occurs in Firefox. Using Internet Explorer uploads still fail, but with the error 'invalid character'.

Edited by CJH (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...

I have more image-errors. Also when uploading an image for the slider or a category. Practically every upload gives an error, but the image is always uploaded.

 

Attached the additional error when uploading a slider image. This error also shows up switching between pages within the admin. For example being at the productpage and going to the categoriespage.

 

I'm not sure if there is a relation between the JSON error:

 

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

post-850717-0-88986600-1413359011_thumb.jpg

Link to comment
Share on other sites

  • 5 weeks later...
  • 2 weeks later...
  • 1 month later...
  • 2 weeks later...

Im having the same error when I try to update a product quantity to -1, while others are correctly updated to -1 or even -100 (internal purposes)...

 

Any cl ues?

 

Thanks!

 

I had same problem now, I had fix it by deleting existing files (olds files uploaded) with FTP.

Link to comment
Share on other sites

I'd more of say its sort of random behaviour, which is even more "p*ssing".... :(

 

@kemdres wdy mean deleting existing files? what files?

 

I removed the *.csv import files in the admin/import/

I left only index.php and .htaccess files in the folder

 

but my problem was not the same of you, the error "JSON.parse: unexpected character at line 1", appear when I try to upload import file *.csv in "Imports CSV"

Edited by kemdres (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

I removed the *.csv import files in the admin/import/

I left only index.php and .htaccess files in the folder

 

but my problem was not the same of you, the error "JSON.parse: unexpected character at line 1", appear when I try to upload import file *.csv in "Imports CSV"

As mesflacons indicated, you got this error 'cause the admin account has logged out when you tried to import a csv file.

 

same error when testing with 1.6.0.11, then I logged in, no more error spawns csv file has been successfully uploaded.

Link to comment
Share on other sites

After update from version 1.6.0.9 to 1.6.0.11 we do get two type JSON.parse error warnings  with updating product quantity ( see screencast capture below). 
Error warning comes with all product tested. Regardless positive or negative product quantity. 

 

Product quantity is updated correctly.  We are on default theme.

 

We don't know the impact of the warning ( could not find related anything simular on the forum )

 

Advice is welcome,

 

Peter

 

Our URL www.derks-wielersport.nl

 

http://screencast.com/t/EbpFCDxUdj

http://screencast.com/t/noQxSOoaCsF

Link to comment
Share on other sites

  • 2 weeks later...

Hi

When trying to upload a miniture in a category i get the message:

 

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

 

How do i fix that

 

Jesper

Uninstall and install the module "BLOCKCATEGORIES" and you will be ok  ;)

Link to comment
Share on other sites

  • 4 months later...

What is your image extension... .JPG or .jpg. I was have problem with image extension. Error was "JSON.parse: unexpected character at line 1 column 1 of the JSON data" and I just change .JPG to .jpg and problem have been solved.

Link to comment
Share on other sites

On my end it has no relation with images, as this happens straight on creating a new product.

 

Ie. add a new product thru the BO, then try to update its quANTity and i get the damn Json error.

Then i must edit it again, update the field twice, then it will save.

 

makes no sense!

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
  • 2 months later...

Bonjour,

Nous avions le même souci lors de l'upload de photos supplémentaires sur les fiches produits.
Nous l'avons corrigé avec cette requête :

ALTER TABLE `ps_image` CHANGE `cover` `cover` TINYINT(1) UNSIGNED NULL DEFAULT '0';
ALTER TABLE `ps_image_shop` CHANGE `cover` `cover` TINYINT(1) UNSIGNED NULL DEFAULT '0';

Bonne journée

 

Hello,

We had the same issue when uplaoding multiple images to a product. We solved it with this upadte on the database :

ALTER TABLE `ps_image` CHANGE `cover` `cover` TINYINT(1) UNSIGNED NULL DEFAULT '0';
ALTER TABLE `ps_image_shop` CHANGE `cover` `cover` TINYINT(1) UNSIGNED NULL DEFAULT '0';

Regards,

Link to comment
Share on other sites

  • 3 months later...

I have this error, too.

 

It's happens when I try do add an image to any product.

This is what I get in developer console:

Warning: Wrong parameter count for clearstatcache() in /home/janetnai/public_html/classes/Uploader.php on line 274
{"file":[{"tmp_name":"\/tmp\/phpIxkMCJ","name":"logo-janetnails-site-sm-phone.png","size":11018,"type":"image\/png","error":0,"status":"ok","id":"2762","position":3,"cover":0,"legend":null,"path":"2\/7\/6\/2\/2762","shops":{"1":true[spam-filter]]}

Please help!

Link to comment
Share on other sites

  • 3 months later...
  • 7 months later...

Hi,

 

having the same problem while uploading a picture to my product. Was able to upload a picture of 2.04 mb, but a one with 2.40 isn`t coming through. Though the limit is 8 mb... can understand the nature of the problem and it just blows my mind. Just started a shop and wouldn`t want to ditch Prestashop at the very beginning...

 

Please help

Link to comment
Share on other sites

  • 2 weeks later...

With Prestashop 1.6.0.14, I have the same error message while uploading the 1st image.

But the cause seems to be different :

<div class="alert alert-danger">
            <button type="button" class="close" data-dismiss="alert">×</button>
                            Duplicate entry '257-1' for key 'id_product_cover'<br /><br />
<pre>INSERT INTO `ps_image` (`id_product`, `position`, `cover`) VALUES ('257', '2', '1')</pre>
</div>

In the end, the picture is not uploaded and there is a line in the table ps_image : id_product = 257,position = 1, cover = 1

It's like prestashop tries to insert twice in the table.

 

I already executed :

ALTER TABLE `ps_image` CHANGE `cover` `cover` TINYINT(1) UNSIGNED NULL DEFAULT '0';
ALTER TABLE `ps_image_shop` CHANGE `cover` `cover` TINYINT(1) UNSIGNED NULL DEFAULT '0';

but it doesn't solve the problem.

 

Any idea?

 

Thanks

Edited by PetitEtreMalfaisant (see edit history)
Link to comment
Share on other sites

  • 4 weeks later...

Hello,
 
I've the same problem when I put the first product in the cart on the FO :

 

Impossible to add the product to the cart.<br/>textStatus: 'parsererror'<br/>errorThrown: 'SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data'<br/>responseText:<br/><pre>Array
(
    [0] => Array
        (
            [file] => /var/www/prestashop/classes/Cart.php
            [line] => 950
            [function] => displayError
            [class] => ToolsCore
            [type] => ::
            [args] => Array
                (
                )
 
        )
 
    [1] => Array
        (
            [file] => /var/www/prestashop/classes/Cart.php
            [line] => 872
            [function] => updateQty
            [class] => CartCore
            [object] => Cart Object
                ( ..........
 
 
When I click again to add a product in the cart, that work and the first product appear in the cart also, it's the same thing when i xant to remove it from the cart.
 
Could you help me please ?
 
 
 
EDIT : SOLVED IT WAS DUE TO A BAD CART RULE ... 
 
 
Thanks
Romain
Edited by parilla77 (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...
×
×
  • Create New...