You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using actor proxies with JSON serialization, response objects of actor methods are not deserialized properly out-of-the-box.
I made a small repro.
A JSON returned by the Dapr runtime could look like this:
Since the object properties are lowercased in the JSON and System.Text.Json is case sensitive by default, the properties of the Person object below are not populated.
As a workaround, I could pass in JsonSerializerOptions when initializing the actor proxy, like so:
It was not immediately apparent to me that I had to set the PropertyNameCaseInsensitive property.
Question: should object properties be matched case-insensitively out-of-the-box when using the JSON serializer?
Please add your feedback in the comments.
The text was updated successfully, but these errors were encountered:
I'd generally expect the JSON object itself to just be shuffled along through the SDK and not have its property names modified anywhere, but I think it makes sense that developers would expect the case to be persisted to and from Dapr so they could provide and configure their own strictness about it.
Is this perhaps just a documentation change that calls out somewhere that if you're using the JSON serialization, there are a few default STJ considerations you should take into account (including case sensitivity)?
When using actor proxies with JSON serialization, response objects of actor methods are not deserialized properly out-of-the-box.
I made a small repro.
A JSON returned by the Dapr runtime could look like this:
with a response object defined like this:
Since the object properties are lowercased in the JSON and System.Text.Json is case sensitive by default, the properties of the
Person
object below are not populated.As a workaround, I could pass in
JsonSerializerOptions
when initializing the actor proxy, like so:It was not immediately apparent to me that I had to set the
PropertyNameCaseInsensitive
property.Question: should object properties be matched case-insensitively out-of-the-box when using the JSON serializer?
Please add your feedback in the comments.
The text was updated successfully, but these errors were encountered: