I have a JSON response from MarkLogic that I am binding to a model in C#. The relevant snippet is below:
{
"snippets":{
"match":[
{
"value":[
"In (consolidated) enforcement actions for failure to answer subpoena, appeal from ",
{
"highlight":{
"value":"judgement"
}
},
" for defendants."
]
}
]
}
}
The problem I am having is with the outer "value" array, since it contains two strings and another JSON object. Is there any way I can bind this array in C#? My current models look like this:
[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; }
}
But using IEnumerable<string> doesn't work when there is an object in the array.