using MongoDB.Driver.GeoJsonObjectModel;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
public string ActionType { get; set; }
public int Sequence { get; set; }
public GeoJsonPoint<GeoJson2DGeographicCoordinates> At { get; set; }
public Action(string actionType, int sequence, JObject at)
if (at != null && at["type"] != null && at["type"].ToString() == "Point" && at["coordinates"] != null)
JArray coordinates = (JArray)at["coordinates"];
double longitude = coordinates[0].Value<double>();
double latitude = coordinates[1].Value<double>();
At = new GeoJsonPoint<GeoJson2DGeographicCoordinates>(new GeoJson2DGeographicCoordinates(longitude, latitude));
static void Main(string[] args)
""actionType"": ""load"",
""coordinates"": [125.6, 10.1]
""actionType"": ""trucking"",
""actionType"": ""deliver"",
""coordinates"": [125.6, 10.1]
var actions = JsonConvert.DeserializeObject<List<Action>>(json);
foreach (var action in actions)
Console.WriteLine($"Action: {action.ActionType}, Sequence: {action.Sequence}, Type: {action.At.Type}, Coordinates: {action.At.Coordinates.Latitude} {action.At.Coordinates.Longitude}");
Console.WriteLine($"Action: {action.ActionType}, Sequence: {action.Sequence}");