'How to limit httpPost size in kb's?

I need to transmit some data in streaming, but the limit is 16kb, above that, the components that will present this data, will give an error

//Get from Database
result = repository.GetAll();

//Converting and Posting
var jsonString = JsonConvert.SerializeObject(result, Formatting.None);
var postToPowerBi = HttpPostAsync(powerBiPostUrl, "[" +jsonString + "]");

How to limit the HttpPostAsync to 16kb to prevent error?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source