How to properly serialize the request/response objects from Kiota? #4898
Replies: 1 comment 8 replies
-
Hi @galvesribeiro This should work better ApiClientBuilder.RegisterDefaultSerializer<JsonSerializationWriterFactory>();
using var ms = KiotaJsonSerializer.SerializeAsStream(revalidateRequest);
using var reader = new StreamReader(ms);
var json = await reader.ReadToEndAsync(); |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello folks!
What is the proper way to get a request or response object generated by Kiota and serialize it with System.Text.Json? If I use a regular
JsonSerializer
it basically serialize it wrong. having unnecessary/null/deafult fields, property names are not as defined on the schema etc.If I try something like this (just test code):
I get this:
The reason I'm asking is that for some business requirements I have to store the exact request and response while interacting with a given service for compliance reasons.
Is there a way to get the proper JSON string serialized/deserialized the same way as Kiota do for send/receive the request/response?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions