20

It would be great and interesting to try out suppressing null and default values when serializing ODATA/JSON payloads. It would be interesting to see if if can shave off payload and a few milliseconds in network connectivity.


Can you please try out the effect of this ? For situations with limited network bandwidth it could have a very positive effect :-)


Here is a small C# samplecode on how to reduce the JSON payload.


using System.Runtime.Serialization;

using System.Text.Json;

using System.Text.Json.Serialization;


[DataContract]

public class TestClass

{

   [DataMember]

    public bool B1 { getset; }

   [DataMember]

    public bool B2 { getset; }

   [DataMember]

    public string? S3 { getset; }

}


class Program

{

    static void Main()

   {

       TestClass tc = new() {B1 = true};

       JsonSerializerOptions options = new JsonSerializerOptions();

        options.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault;

        var serialized = JsonSerializer.Serialize(tc, options);

       Console.WriteLine(serialized);

   }

}

Prints: {"B1":true}

Category: Performance
STATUS DETAILS
Planned
Ideas Administrator

The product team has agreed to implement this feature and is actively working on it.  Please stay tunned for targeted release version information and usage documentation.