Created
December 9, 2014 02:02
-
-
Save andrewconnell/1221887e8d5fbe532f66 to your computer and use it in GitHub Desktop.
XML vs. JSON Serialization in Server Side Code - Snippet 3
This file contains 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 System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using Newtonsoft.Json; | |
namespace TasksWeb.Models { | |
public class SpTaskJsonCollection { | |
[JsonProperty(PropertyName = "d")] | |
public DataCollectionReponse Data { get; set; } | |
} | |
public class SpTaskJsonSingle { | |
[JsonProperty(PropertyName = "d")] | |
public SpTaskJson Data { get; set; } | |
} | |
public class DataCollectionReponse { | |
[JsonProperty(PropertyName = "results")] | |
public SpTaskJson[] Results { get; set; } | |
} | |
public class SpTaskJson { | |
public __Metadata __metadata { get; set; } | |
public int Id { get; set; } | |
public string Title { get; set; } | |
public string Priority { get; set; } | |
public string Status { get; set; } | |
public int ID { get; set; } | |
} | |
public class __Metadata { | |
[JsonProperty(PropertyName = "id")] | |
public string Id { get; set; } | |
[JsonProperty(PropertyName = "uri")] | |
public string Uri { get; set; } | |
[JsonProperty(PropertyName = "etag")] | |
public string ETag { get; set; } | |
[JsonProperty(PropertyName = "type")] | |
public string Type { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment