MarkLogic의 JSON 응답을 사용하여 C#의 모델에 바인딩했습니다. 관련 조각은 다음과 같습니다 :.NET의 배열 내부에 JSON 객체 바인딩
{
"snippets":{
"match":[
{
"value":[
"In (consolidated) enforcement actions for failure to answer subpoena, appeal from ",
{
"highlight":{
"value":"judgement"
}
},
" for defendants."
]
}
]
}
}
는 두 개의 문자열 및 다른 JSON 객체를 포함하고 있기 때문에 내가 데 문제는, 외부 "값"배열입니다. C#에서이 배열을 바인딩 할 수있는 방법이 있습니까? 나의 현재의 모델은 다음과 같이 :
[JsonProperty(PropertyName = "snippets")]
public MarkLogicSnippetsModel Snippets { get; set; }
public class MarkLogicSnippetsModel
{
[JsonProperty(PropertyName = "match")]
public IEnumerable<MarkLogicMatchModel> Matches { get; set; }
}
public class MarkLogicMatchModel
{
[JsonProperty(PropertyName = "value")]
public IEnumerable<string> Values { get; set; }
}
그러나 배열의 객체가있을 때 작동하지 않습니다 IEnumerable<string>
를 사용하여.
JSON이 유효하지 않습니다. –
@PaulSwetz 반환 된 응답의 일부일 뿐이므로 복사했을 때 유효하지 않은 이유입니다. – OstrichGlue