0

我尝试了 3 种不同的 JSON 类生成器,但是当我尝试从以下 JSON 输出生成 C# 类时出现错误:

{
"status": "REQUEST_STATUS",
"language": "DOCUMENT_LANGUAGE",
"url": "REQUESTED_URL",
"text": "DOCUMENT_TEXT",
"entities": [
    "entity": {
        "type": "DETECTED_TYPE",
        "relevance": "DETECTED_RELEVANCE",
        "count": "DETECTED_COUNT",
        "text": "DETECTED_ENTITY"
        "disambiguated": {
            "name": "DISAMBIGUATED_ENTITY",
            "subType": "ENTITY_SUBTYPE",
            "website": "WEBSITE",
            "geo": "LATITUDE LONGITUDE",
            "dbpedia": "LINKED_DATA_DBPEDIA",
            "yago": "LINKED_DATA_YAGO",
            "opencyc": "LINKED_DATA_OPENCYC",
            "umbel": "LINKED_DATA_UMBEL",
            "freebase": "LINKED_DATA_FREEBASE",
            "ciaFactbook": "LINKED_DATA_FACTBOOK",
            "census": "LINKED_DATA_CENSUS",
            "geonames": "LINKED_DATA_GEONAMES",
            "musicBrainz": "LINKED_DATA_MUSICBRAINZ",
            "crunchbase": "CRUNCHBASE_WEB_LINK",
        },
        "quotations": [
            {
                "quotation": "ENTITY_QUOTATION"
            }
        ],
        "sentiment": {
            "type": "SENTIMENT_LABEL",
            "score": "SENTIMENT_SCORE",
            "mixed": "SENTIMENT_MIXED"
        }
    }
  ]
}

错误在以下行的括号中:

"entities": [

但是我发现使用上述两个工具的所有示例都有使用像我这样的数组的示例,那么为什么我的会导致异常。例外是“无效字符和第 7 行位置 17。

如果我将直括号更改为大括号,它将生成,但这会改变类,对吗?

4

1 回答 1

0

数组内部的东西本身没有名称,所以只需更改

"entities": [
   "entity": {
      "type": "DETECTED_TYPE",

"entities": [ {
   "type": "DETECTED_TYPE",
于 2013-09-04T00:27:29.583 回答