简体   繁体   English

如何区分这是什么类型的 JSON API 响应?

[英]How can I distinguish what type of JSON API response this is?

I am new to JSON and XML.我是 JSON 和 XML 的新手。 When doing a POST or GET request to an API, how can I tell the type of response given?对 API 执行 POST 或 GET 请求时,如何判断给出的响应类型? For example, is it JSON or RAW or application?例如,它是 JSON 还是 RAW 或应用程序? Can someone tell me what kind of response this is from a web API?有人能告诉我这是来自 Web API 的什么样的响应吗? Why are there quotes around every key and property?为什么每个键和属性周围都有引号?

HTTP/1.1 200 OK
{
  "audioChannels": "5.1",
  "audioCodec": "DolbyDigital",
  "container": "mkv",
  "episodeNumber": 3,
  "format": "WEBRip",
  "mimetype": "video/x-matroska",
  "releaseGroup": "NTb",
  "screenSize": "1080p",
  "season": 2,
  "series": "House of Cards",
  "title": "NF",
  "type": "episode",
  "videoCodec": "h264",
  "year": 2013
}

Is this JSON?这是 JSON 吗? JSONP? JSONP? XML? XML? What is this?这是什么?

这是一个普通的 JSON 响应(带有一些 HTTP 响应信息)。

This is an API response from GuessIt.这是 GuessIt 的 API 响应。 GuessIt itself is a python library that tries to extract as much information as possible from a filename. GuessIt 本身是一个 python 库,它试图从文件名中提取尽可能多的信息。

Web Service API网络服务API

The guessit.io server also provides a free webservice that allows you to perform filename detection, even you don't have python installed (eg: you need to use it from an Android app, or NodeJS, etc.). guessit.io 服务器还提供了一个免费的网络服务,允许您执行文件名检测,即使您没有安装 python(例如:您需要从 Android 应用程序或 NodeJS 等中使用它)。

You can look at the documentation for the web API here:您可以在此处查看 Web API 的文档:

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

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