Guest User

Untitled

a guest
Jun 23rd, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. public class StockQuotesResultDto
  2. {
  3. [JsonProperty("Meta Data")]
  4. public MetaData MetaData { get; set; }
  5.  
  6. [JsonProperty("Stock Quotes")]
  7. public StockQuoteDto[] StockQuotes { get; set; }
  8. }
  9.  
  10. //[Preserve(AllMembers = true)]
  11. public class MetaData
  12. {
  13. [JsonProperty("1. Information")]
  14. public string Information { get; set; }
  15.  
  16. [JsonProperty("2. Notes")]
  17. public string Notes { get; set; }
  18.  
  19. [JsonProperty("3. Time Zone")]
  20. public string TimeZone { get; set; }
  21. }
  22.  
  23. //[Preserve(AllMembers = true)]
  24. public class StockQuoteDto
  25. {
  26. [JsonProperty("1. symbol")]
  27. public string Symbol { get; set; }
  28.  
  29. [JsonProperty("2. price")]
  30. public string Price { get; set; }
  31.  
  32. [JsonProperty("3. volume")]
  33. public string Volume { get; set; }
  34.  
  35. [JsonProperty("4. timestamp")]
  36. public string Timestamp { get; set; }
  37.  
  38. }
  39.  
  40. {
  41. "Meta Data": {
  42. "1. Information": "Batch Stock Market Quotes",
  43. "2. Notes": "IEX Real-Time Price provided for free by IEX (https://iextrading.com/developer/).",
  44. "3. Time Zone": "US/Eastern"
  45. },
  46. "Stock Quotes": [
  47. {
  48. "1. symbol": "MSFT",
  49. "2. price": "100.2500",
  50. "3. volume": "--",
  51. "4. timestamp": "2018-06-22 15:59:57"
  52. },
  53. {
  54. "1. symbol": "FB",
  55. "2. price": "201.4100",
  56. "3. volume": "--",
  57. "4. timestamp": "2018-06-22 15:59:59"
  58. },
  59. {
  60. "1. symbol": "AAPL",
  61. "2. price": "185.3900",
  62. "3. volume": "--",
  63. "4. timestamp": "2018-06-22 16:01:08"
  64. }
  65. ]
  66. }
  67.  
  68. StockQuotesResultDto stockQuotes = JsonConvert.DeserializeObject<StockQuotesResultDto>(contentAsString);
Add Comment
Please, Sign In to add comment