Skip to content

Commit b47f48c

Browse files
authored
Fixed samples (#14835)
Parse method doesn't allow trailing commas in JSON
1 parent 07773ac commit b47f48c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

sdk/eventgrid/Azure.Messaging.EventGrid/tests/Samples/Sample2_ParseAndDeserializeEvents.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ namespace Azure.Messaging.EventGrid.Tests.Samples
1717
public partial class EventGridSamples : SamplesBase<EventGridTestEnvironment>
1818
{
1919
// Example JSON payloads
20-
private readonly string jsonPayloadSampleOne = "[{ \"id\": \"2d1781af-3a4c\", \"topic\": \"/examples/test/payload\", \"subject\": \"\", \"data\": { \"name\": \"example\",\"age\": 20 },\"eventType\": \"MyApp.Models.CustomEventType\",\"eventTime\": \"2018-01-25T22:12:19.4556811Z\",\"dataVersion\": \"1\"}]";
20+
private readonly string jsonPayloadSampleOne = "[{ \"id\": \"2d1781af-3a4c\", \"topic\": \"/examples/test/payload\", \"subject\": \"\", \"data\": { \"Name\": \"example\",\"Age\": 20 },\"eventType\": \"MyApp.Models.CustomEventType\",\"eventTime\": \"2018-01-25T22:12:19.4556811Z\",\"dataVersion\": \"1\"}]";
2121

22-
private readonly string jsonPayloadSampleTwo = "[{ \"id\": \"2d1781af-3a4c\", \"source\": \"/examples/test/payload\", \"data\": { \"Name\": \"example\",\"Age\": 20, },\"type\": \"MyApp.Models.CustomEventType\",\"time\": \"2018-01-25T22:12:19.4556811Z\",\"specversion\": \"1\"},]";
22+
private readonly string jsonPayloadSampleTwo = "[{ \"id\": \"2d1781af-3a4c\", \"source\": \"/examples/test/payload\", \"data\": { \"name\": \"example\",\"age\": 20 },\"type\": \"MyApp.Models.CustomEventType\",\"time\": \"2018-01-25T22:12:19.4556811Z\",\"specversion\": \"1\"}]";
2323

2424
// This sample demonstrates how to parse EventGridEvents from JSON and access event data using GetData()
2525
[Test]
@@ -65,7 +65,6 @@ public async Task GenericReceiveAndDeserializeEventGridEvents()
6565
JsonObjectSerializer myCustomSerializer = new JsonObjectSerializer(
6666
new JsonSerializerOptions()
6767
{
68-
AllowTrailingCommas = true,
6968
PropertyNameCaseInsensitive = true
7069
});
7170

0 commit comments

Comments
 (0)