using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json.Linq;
public static void Main()
var myEntity = JsonConvert.DeserializeObject<List<MyTable>>(Json);
public const string Json = @"[{
""Name"": ""ExampleName"",
""Surname"": ""ExampleSurname"",
""Fathername"": ""ExampleFathername"",
""Name"": ""TranslatedName"",
""Surname"": ""TranslatedSurname"",
""Fathername"": ""TranslatedFathername"",
public class HierarchyIdConverter : JsonConverter<HierarchyId>
public override HierarchyId? ReadJson(JsonReader reader, Type objectType, HierarchyId existingValue, bool hasExistingValue, JsonSerializer serializer)
var token = JToken.Load(reader);
if (token.Type == JTokenType.String)
var hierarchyIdString = token.Value<string>();
if (hierarchyIdString == "/")
return HierarchyId.GetRoot();
return HierarchyId.Parse(hierarchyIdString);
public override void WriteJson(JsonWriter writer, HierarchyId value, JsonSerializer serializer)
writer.WriteValue(value.ToString());
public virtual Guid Id { get; set; }
[JsonConverter(typeof(HierarchyIdConverter))]
public HierarchyId HierarchyId { get; set; }
public int HierarchyLevel { get; set; }
public virtual ICollection<MyTableContent> Contents { get; set; } = new List<MyTableContent>();
public class MyTableContent
public virtual Guid Id { get; set; }
public string? Name { get; set; }
public string? Surname { get; set; }
public string? Fathername { get; set; }
public MyTable MyTable { get; set; }
public Guid MyTableId { get; set; }