John Riker

John Riker

  • NA
  • 85
  • 14.1k

Duplicate JSON classes

Nov 9 2020 5:58 PM
I'm creating a program that has multiple independent processes that grab JSON from different sites. So I copy the JSON results and Paste Special into my project and it creates the associated class info. So the problem.
 
I paste in the first one and get like:
  1. public class Rootobject    
  2. {    
  3.      public Datum[] data { getset; }    
  4.      public Meta meta { getset; }    
  5.      public Links links { getset; }    
  6. }    
  7.     
  8. public class Meta    
  9. {    
  10.      public int count { getset; }    
  11.      public string version { getset; }    
  12. }    
  13.     
  14. public class Links    
  15. {    
  16.      public string self { getset; }    
  17.      public string first { getset; }    
  18.      public string last { getset; }    
  19.      public string next { getset; }    
  20. }    
  21.     
  22. public class Datum    
  23. {    
  24.      public string type { getset; }    
  25.      public string id { getset; }    
  26.      public Attributes attributes { getset; }    
  27.      public Relationships relationships { getset; }    
  28.      public Links4 links { getset; }   
  29. }  
Then I go to the other source and get:
  1. public class Rootobject    
  2. {    
  3.     public Result result { getset; }    
  4.     public bool success { getset; }    
  5. }    
  6.     
  7. public class Result    
  8. {    
  9.     public string title { getset; }    
  10.     public Datum[] data { getset; }    
  11.     public int total { getset; }    
  12. }    
  13.     
  14. public class Datum    
  15. {    
  16.     public string type { getset; }    
  17.     public string title { getset; }    
  18.     public string series_title { getset; }    
  19.     public string label { getset; }    
  20.     public string content_id { getset; }    
  21.     public string airdate { getset; }    
  22.     public long airdate_ts { getset; }    
  23.     public DateTime airdate_iso { getset; }    
  24.     public string expiredate_raw { getset; }    
  25.     public string season_number { getset; }    
  26.     public string episode_number { getset; }    
  27.     public string duration { getset; }    
  28.     public int duration_raw { getset; }    
  29.     public string rating { getset; }    
  30.     public Regionalratings regionalRatings { getset; }    
  31.     public string description { getset; }    
  32.     public Thumb thumb { getset; }    
  33.     public string url { getset; }    
  34.     public string app_url { getset; }    
  35.     public string amazon_est_url { getset; }    
  36.     public string itunes_est_url { getset; }    
  37.     public string streaming_url { getset; }    
  38.     public string live_streaming_url { getset; }    
  39.     public string tms_program_id { getset; }    
  40.     public object show_id { getset; }    
  41.     public string asset_type { getset; }    
  42.     public string status { getset; }    
  43.     public string expiry_date { getset; }    
  44.     public bool is_paid_content { getset; }    
  45.     public string ios_available_status { getset; }    
  46.     public string ios_available_date { getset; }    
  47.     public string android_available_status { getset; }    
  48.     public string android_available_date { getset; }    
  49.     public long tracking_media_id { getset; }    
  50.     public object signature { getset; }    
  51.     public object media_type { getset; }    
  52.     public object vtag { getset; }    
  53.     public bool is_live { getset; }    
  54.     public int medTime { getset; }    
  55.     public string genre { getset; }    
  56.     public Metadata metaData { getset; }    
  57.     public string brand { getset; }    
  58.     public string[] videoProperties { getset; }    
  59.     public string media_content_type { getset; }    
  60.     public object mpd_url { getset; }    
  61.     public object license_url { getset; }    
  62.     public object closed_captions { getset; }    
  63.     public int positionNum { getset; }    
  64.     public bool is_protected { getset; }    
  65.     public bool drm { getset; }    
  66.     public string raw_url { getset; }    
  67.     public string episode_title { getset; }    
  68.     public object pubdate_iso { getset; }    
  69.     public string thumbUrl { getset; }    
  70.     public bool isUserSubscriber { getset; }    
  71.     public string aaLink { getset; }    
  72.     public string dataTracking { getset; }    
  73.     public string displayTitle { getset; }    
  74. }  
There is more to both of these but basically Rootobject and Datum are duplicated. Any way to deal with this?
 
Thanks.
JR

Answers (2)