简体   繁体   English

JSON 中的 Amazon S3 响应?

[英]Amazon S3 response in JSON?

According to the doc http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketGET.html the S3 service seems to respond in XML.根据文档http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketGET.html,S3服务似乎以 XML 响应。

Is there a way to get it in JSON format instead?有没有办法以 JSON 格式获取它?

No.不。

Also the response is not always valid XML!此外,响应并不总是有效的 XML! This is a known bug in S3.这是 S3 中的一个已知错误。 In S3 you can use any UTF-8 string as a key for an object, including ones with XML invalid characters (<, > etc are fine) but some weird control characters are NOT.在 S3 中,您可以使用任何UTF-8 字符串作为对象的键,包括带有 XML 无效字符的字符串(<、> 等很好),但一些奇怪的控制字符则不然。

So if somehow you get a file up on S3 with a weird enough string as a key, asking for a listing of that will return invalid XML!因此,如果您以某种方式在 S3 上使用足够奇怪的字符串作为键获取文件,则要求列出该文件将返回无效的 XML!

So perhaps they could fix this bug by making some sort of JSON return as an option, but don't look for it soon.所以也许他们可以通过将某种 JSON 返回作为一个选项来修复这个错误,但不要很快寻找它。 The XML bug has been known for years. XML 错误已为人所知多年。 https://forums.aws.amazon.com/thread.jspa?threadID=10869 https://forums.aws.amazon.com/thread.jspa?threadID=82485 https://forums.aws.amazon.com/thread.jspa?threadID=10869 https://forums.aws.amazon.com/thread.jspa?threadID=82485

Another sore point is that its impossible (at least when I tried a year ago) to get the XML response gzipped.另一个痛点是不可能(至少当我一年前尝试时)将 XML 响应压缩。 So you waste lots of bandwidth transmitting very fluffy XML.因此,您浪费了大量带宽来传输非常松散的 XML。

It's time for S3 to support a new returned data format that is compressed and robust.是时候让 S3 支持一种新的、压缩的、健壮的返回数据格式了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM