Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Webclient.Downloadstring();
- var data = "{"err":[],"msg":[],"state":null," +
- "rec":{"Vin":"1ABC2DEF3GH45678"," +
- ""REG":"ST-ABC123","int":"12345678"," +
- ""Make":"GMC","Model":"YUKON"," +
- ""Type":"SUV","Color":"black metallic",";
- public class Program
- {
- public static void Main(string[] args)
- {
- var data = "{"err":[],"msg":[],"state":null," +
- "rec":{"Vin":"1ABC2DEF3GH45678"," +
- ""REG":"ST-ABC123","int":"12345678"," +
- ""Make":"GMC","Model":"YUKON"," +
- ""Type":"SUV","Color":"black metallic",";
- data = doc.Replace('{', ' ');
- data = doc.Replace('"', ' ');
- data = doc.Replace('}', ' ');
- var sub = data.Split(':', ',');
- for(int i = 0; i < sub.Length; i++)
- {
- sub[i] = sub[i].Trim();
- /*Console.WriteLine("{0} : {1}", i, sub[i]);
- Outputs :
- 0 : err
- 1 : []
- 2 : msg
- 3 : []
- 4 : state
- 5 : null
- 6 : rec
- 7 : Vin
- 8 : 1ABC2DEF3GH45678
- 9 : REG
- 10 : ST-ABC123
- 11 : int
- 12 : 12345678
- 13 : Make
- 14 : GMC
- 15 : Model
- 16 : YUKON
- 17 : Type
- 18 : SUV
- 19 : Color
- 20 : black metallic
- 21 :
- */
- }
- Vehicle vehicle = new Vehicle(sub[8], sub[10], sub[12], sub[14], sub[16], sub[18], sub[20]);
- }
- }
- public class Vehicle
- {
- public string Vin { get; set; }
- public string Registration { get; set; }
- public string ID { get; set; }
- public string Make { get; set; }
- public string Model { get; set; }
- public string VehicleType { get; set; }
- public string Color { get; set; }
- public string Nav { get; set; }
- public string Transmission { get; set; }
- public Vehicle(string _Vin, string _Reg, string _ID, string _Make, string _Model, string _Type, string _Color)
- {
- this.Vin = _Vin;
- this.Registration = _Reg;
- this.ID = _ID;
- this.Make = _Make;
- this.Model = _Model;
- this.VehicleType = _Type;
- this.Color = _Color;
- }
- }
Add Comment
Please, Sign In to add comment