using Newtonsoft.Json; [System.Serializable] public class RobotData { [JsonProperty("Crd")] public string crd { get; set; } [JsonProperty("Rx")] public float rx { get; set; } [JsonProperty("Ry")] public float ry { get; set; } [JsonProperty("Rz")] public float rz { get; set; } [JsonProperty("X")] public float x { get; set; } [JsonProperty("Y")] public float y { get; set; } [JsonProperty("Z")] public float z { get; set; } [JsonProperty("J1")] public float j1 { get; set; } [JsonProperty("J2")] public float j2 { get; set; } [JsonProperty("J3")] public float j3 { get; set; } [JsonProperty("J4")] public float j4 { get; set; } [JsonProperty("J5")] public float j5 { get; set; } [JsonProperty("J6")] public float j6 { get; set; } public float this[int index] { get => index switch { 0 => j1, 1 => j2, 2 => j3, 3 => j4, 4 => j5, 5 => j6, _ => 0f }; set { switch (index) { case 0: j1 = value; break; case 1: j2 = value; break; case 2: j3 = value; break; case 3: j4 = value; break; case 4: j5 = value; break; case 5: j6 = value; break; } } } }