Can json be stored on amazon s3?

I would like to save the json file on my amazon s3 and then get it using ajax request. Unfortunately, s3 doesn't seem to allow the content-type / json application ....

Should I save my file as text / plain and then add a header with php?

+8
json javascript amazon-s3
source share
2 answers

I found a problem. I parsed json incorrectly.

$.ajax({ url:"https://s3.amazonaws.com/myBucket/myfile.json", type:"GET", success:function(data) { console.log(data.property) } }) 

Instead it works:

 $.ajax({ url:"https://s3.amazonaws.com/myBucket/myfile.json", type:"GET", success:function(data) { var obj = jQuery.parseJSON(data); if(typeof obj =='object'){ console.log(obj.property) } } }) 
+5
source share

Change the Metadata value in the Key: Value field to Application / json from the file properties in the AWS S3 console.

+2
source share

All Articles