JSON.NET을 사용하여이 json을 비 직렬화 할 수 있습니까?숫자로 명명 된 객체로이 JSON을 비 직렬화 할 수 있습니다.
"players": {
"0": {
"success": 1,
"name": "xsusususdd"
},
"1": {
"success": 1,
"name": "bleeps"
},
..."n": {
"success": 1,
"name": "bloops"
}
}
내가 배열하지만 중첩 된 객체의 임의의 숫자로 구성되어 오히려 객체를 반환하지 않습니다 사용하고 제 3 자 웹 서비스를 제공합니다.
내가의 라인을 따라 뭔가로 시작 해요 :
public class Players
{
public Player 0 {get;set;} //cant name the Player 0
public Player 1 {get;set;} //cant name the Player 1
public List<Players> players {get;set;} //doesn't work because it isn't being returned as an array
}
public class Player
{
public string success { get; set; }
public string name { get; set; }
}
var URL = new WebClient().DownloadString("http://webservice");
Players result = JsonConvert.DeserializeObject<Players>(URL);
편도로 배열로 만들면 –
수 있습니다 당신은 정교한? 배열로 – woggles
내 말은, 미안 해요, 그냥 regex.replace와 빈 문자열 "숫자"를 대체 –