✅ STJ cannot deserialize record struct with TimeOnly
See REPL. Why is this the case and what can I do? This is a json I recieve from a remote api
34 Replies
Hin
REPL Result: Success
Result: ValueWithTime
Compile: 596.992ms | Execution: 76.192ms | React with ❌ to remove this embed.
I think this is because you can't set properties of structs using reflection
Hmm
Hin
REPL Result: Success
Result: ValueWithTime
Compile: 577.887ms | Execution: 88.690ms | React with ❌ to remove this embed.
Thinker
REPL Result: Failure
Exception: JsonException
Compile: 519.984ms | Execution: 35.990ms | React with ❌ to remove this embed.
You'll have to make your own converter I think
Damn it
Hin
REPL Result: Success
Result: TimeOnly
Compile: 493.913ms | Execution: 41.636ms | React with ❌ to remove this embed.
Ok, gonna try
Hin
REPL Result: Success
Result: ValueWithTime
Compile: 649.864ms | Execution: 83.945ms | React with ❌ to remove this embed.
Hin
REPL Result: Success
Result: ValueWithTime
Compile: 653.156ms | Execution: 83.615ms | React with ❌ to remove this embed.
Hin
REPL Result: Success
Result: ValueWithTime
Compile: 576.978ms | Execution: 77.966ms | React with ❌ to remove this embed.
Hin
REPL Result: Success
Result: ValueWithTime
Compile: 610.089ms | Execution: 80.949ms | React with ❌ to remove this embed.
Hin
REPL Result: Success
Result: ValueWithTime
Compile: 628.868ms | Execution: 81.249ms | React with ❌ to remove this embed.
this is for DateOnly, but you get the idea
this should already be included in .net 7 thou
Thats what I thought, but no eta
Hin
REPL Result: Success
Result: ValueWithTime
Compile: 702.348ms | Execution: 106.659ms | React with ❌ to remove this embed.
Fuck you too, stj
Hin
REPL Result: Failure
Exception: JsonException
Compile: 702.211ms | Execution: 90.297ms | React with ❌ to remove this embed.
And why tf they are missing
Hin
REPL Result: Success
Result: string
Compile: 827.257ms | Execution: 122.081ms | React with ❌ to remove this embed.
Wait, is it...
Hin
REPL Result: Success
Result: ValueWithTime
Compile: 765.091ms | Execution: 103.975ms | React with ❌ to remove this embed.
The fuck...
Default stj cannot comprehend camelCase????
Brb gonna kill myself
(joke)
You can configure it to use camelCase
I know
I thought it is the default
Maybe it is in asp controllers..?
I think the default ASP.NET serializer probably overrides the casing
Hin
REPL Result: Success
Result: ValueWithTime
Compile: 703.383ms | Execution: 98.088ms | React with ❌ to remove this embed.
Hin
REPL Result: Failure
Exception: JsonException
Compile: 728.191ms | Execution: 96.349ms | React with ❌ to remove this embed.
Ok so I still need the converter
Hin
REPL Result: Failure
Exception: CompilationErrorException
Compile: 789.020ms | Execution: 0.000ms | React with ❌ to remove this embed.
where
Hin
REPL Result: Success
Result: ValueWithTime
Compile: 772.635ms | Execution: 99.206ms | React with ❌ to remove this embed.
Neat