using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
public class SearchPoints
public bool Valid { get; set; }
public Result Result { get; set; }
public List<string> Errors { get; set; }
public List<Point> Points { get; set; }
public List<Category> Categories { get; set; }
public long CategoryId { get; set; }
public string Name { get; set; }
public long ParentId { get; set; }
public string Parent { get; set; }
public long PointId { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string Latitude { get; set; }
public string Longitude { get; set; }
[JsonConverter(typeof(EmptyTolerantStringEnumConverter))]
public Floor? Floor { get; set; }
public List<string> Aliases { get; set; }
public List<string> Comments { get; set; }
public List<string> Images { get; set; }
public class EmptyTolerantStringEnumConverter : StringEnumConverter
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
if (reader.TokenType == JsonToken.String && string.IsNullOrWhiteSpace(reader.Value.ToString()))
return Activator.CreateInstance(objectType);
return base.ReadJson(reader, objectType, existingValue, serializer);
public static void Test()
var apiContent = GetJson();
var pointsJsonResponse = JsonConvert.DeserializeObject<SearchPoints>(apiContent);
pointsJsonResponse.Dump();
""name"": ""Building one"",
""description"": ""Office of Technology and Data Application Development"",
public static void Main()
Console.WriteLine("Environment version: " + Environment.Version);
Console.WriteLine("Json.NET version: " + typeof(JsonSerializer).Assembly.FullName);
Console.WriteLine("Failed with unhandled exception: ");