public override void WriteJson(JsonWriter writer, object?value, JsonSerializer serializer) { if (value == null) { writer.WriteNull(); return; } DataSet dataSet = (DataSet)value; DefaultContractResolver?resolver = serializer.ContractResolver as DefaultContractResolver; DataTableConverter converter = new DataTableConverter(); writer.WriteStartObject(); foreach (DataTable table in dataSet.Tables) { writer.WritePropertyName((resolver != null) ? resolver.GetResolvedPropertyName(table.TableName) : table.TableName); converter.WriteJson(writer, table, serializer); } writer.WriteEndObject(); }