-
-
Save simplement-e/b5854183a30a3967c597 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Newtonsoft.Json; | |
using Newtonsoft.Json.Linq; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication1 | |
{ | |
[JsonObject()] | |
public class Unnamed | |
{ | |
public Team team { get; set; } | |
public override string ToString() | |
{ | |
return string.Format("team = {0}", team); | |
} | |
} | |
[JsonObject("team")] | |
public class Team | |
{ | |
[JsonProperty("international_date")] | |
public bool InternationalDate { get; set; } | |
[JsonProperty("is_coed")] | |
public bool IsCoed { get; set; } | |
[JsonProperty("team_name")] | |
public string TeamName { get; set; } | |
public override string ToString() | |
{ | |
return string.Format("{0};{1};{2}", InternationalDate, IsCoed, TeamName); | |
} | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string s = "[{team: {international_date: false,is_coed: false,team_name: 'foo bar'} }, { team: { international_date: false, is_coed: false,team_name: 'foo bar'}}]"; | |
Unnamed[] un = Newtonsoft.Json.JsonConvert.DeserializeObject<Unnamed[]>(s); | |
foreach (var r in un) | |
Console.WriteLine(r); | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hai do