Bad Params Field Invalid JSON

Archived from the Transloadit support forum. Originally posted on April 29, 2012; details may be outdated, see our docs for current behavior. Original thread

Hi there,
I’m trying to test basic upload to my S3 account using a template and the jQuery plugin.

Authentication is disabled and my params object contains my key and template_id

{"auth": {
      "key": "REDACTED"
    },
    "template_id": "MY_TEMPLATE_ID" }

I have tried adding / removing a redirect_url, however no matter what I do the response is “Bad params field, invalid json”

Any help would be appreciated.

Thanks.

Hey kartik,

do you have an assembly id that I can look at?

Hi Tim,
I was able to get this to work by stringifying the JSON and not encoding HTML entities.

The minimal integration example however uses encoded JSON, have I missed something ?

Nope, you haven’t missed anything. Well in order to put a json string into the hidden input field one has to convert the quotation marks to "

So I doubt it would work without the htmlentities.

I thought so too, however I had the opposite experience.

Using Chrome 18 on Mac OSX, If I set the params field to the htmlentities escaled value then I get the invalid json error, if I used the strinfgified JSON then everything works.

Could it have something to do with the fact that I am appending the params input dynamically using jQuery ?

--Kartik

That could be yes. Do you have this online somewhere so I could take a closer look?

I am having the same problem, in using uploadify (uploadifive) ..

here is my uploadifive code:

$('#file_upload').uploadifive({
              'uploadScript' : '<%= TRANSLOADIT_UPLOAD_URL %>',
              'formData'      : {
                        'params' : '<%= CGI::escape(params).html_safe  %>', 
                        'signature' : '<%=  CGI::escape(signature).html_safe %>'
                }
            });

where params and signature is calculated based on the example given in http://transloadit.com/docs/authentication

Any help, tim?

The post content:

Content-Disposition: form-data; name=“params” %7B%22auth%22%3A%7B%22expires%22%3A%222012%2F05%2F28+06%3A25%3A31%2B00%3A00%22%2C%22key%22%3A%REDACTED%22%7D%2C%22template_id%22%3A%REDACTED%22%7D ---------------------------1338184536317 Content-Disposition: form-data; name=“signature” REDACTED ---------------------------1338184536317–

the TRANSLOADIT_UPLOAD_URL value is “http://api2.transloadit.com/assemblies”

Could you please paste the escaped params value here (keep in mind that this support topic is public atm). Also it would help if I could see this online somewhere. : )

Hey Will,

have you resolved this already?

Hello Tim,

SOlved! will share the details.

Thanks !

Closing this