'JsonNumberHandlingAttribute' is only valid on a number or a collection of numbers when applied to a property or field.
See original GitHub issueDescribe the bug ‘JsonNumberHandlingAttribute’ is only valid on a number or a collection of numbers when applied to a property or field.
To Reproduce Steps to reproduce the behavior: 1.QdrantVectorDbClient.cs Line-132
public async Task<QdrantVectorRecord?> GetVectorByPayloadIdAsync(...)
{
...
// Line-132
var data = JsonSerializer.Deserialize<SearchVectorsResponse>(responseContent);
...
}
Expected behavior ‘JsonNumberHandlingAttribute’ is only valid on a number or a collection of numbers when applied to a property or field. See member ‘Id’ on type ‘Microsoft.SemanticKernel.Connectors.Memory.Qdrant.Http.ApiSchema.SearchVectorsResponse+ScoredPoint’.
Screenshots If applicable, add screenshots to help explain your problem.
Issue Analytics
- State:
- Created 4 months ago
- Reactions:2
- Comments:11 (5 by maintainers)
Top Results From Across the Web
JsonNumberHandlingAttribute on non-number collection ...
NET 6 breaking change where JsonNumberHandlingAttribute can now only be applied to properties that are collections of numbers.
Read more >System.Text.Json: Deserialize JSON with automatic casting
The current implementation throws System.InvalidCastException: Unable to cast object of type 'System.Collections.Generic.List 1[System.String]' ...
Read more >JsonNumberHandlingAttribute Class (System.Text.Json. ...
When placed on a type, property, or field, indicates what JsonNumberHandling settings should be used when serializing or deserializing numbers.
Read more >Viewing online file analysis results for 'main.exe'
'JsonNumberHandlingAttribute' is only valid on a number or a collection of numbers when applied to a property or field.
Read more >C# serialization with JsonSchema and System.Text.Json
Learn how code generation can build on System.Text.Json and JSON Schema to create a great experience for C# developers.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This issue seems to still be occurring in “0.15.230531.5-preview”. I’ve just updated to the latest release & with no other code changes, have just run into this issue.
Id was previously set using strings in our vector db.
IE: We’re looping though a JSON list of QnA items and saving them into a collection. The filename in our case, is named to represent the team / process the QnA list targets.
await _memory.SaveInformationAsync("QnACollection", qnaItem, $"{file.Name}-q{i}");
Not sure if we need to change anything here, but my understanding of QDrant is that a string value or an int should be accepted.
Sorry about this, we brought in a PR last week that was supposed to allow both numbers and strings for that property (Qdrant allows this) and it appears to have caused a regression.
To unblock yourself, you can remove the JsonNumberHandling attribute from ScoredPoint:
We will take another pass at fixing this!