Skip to content

Commit

Permalink
Merge pull request #57 from richdog/jagged-array-formatter-trailing-c…
Browse files Browse the repository at this point in the history
…omma

remove trailing comma from jagged array formatter
  • Loading branch information
genaray authored Dec 18, 2023
2 parents f533a44 + 0da28ae commit 6c8d173
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Arch.Persistence/Json.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,19 @@ public void Serialize(ref JsonWriter writer, JaggedArray<T> value, IJsonFormatte
// Write items
writer.WritePropertyName("items");
writer.WriteBeginArray();
for (var index = 0; index < value.Capacity; index++)

for (int index = 0; index < value.Capacity; index++)
{
var item = value[index];
T? item = value[index];
JsonSerializer.Serialize(ref writer, item, formatterResolver);
writer.WriteValueSeparator();
}

// Cut last value seperator
if (value.Capacity > 0)
{
writer.AdvanceOffset(-1);
}
writer.WriteEndArray();
writer.WriteEndObject();
}
Expand Down

0 comments on commit 6c8d173

Please sign in to comment.