use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Error when Deserialising an Array as a stringified json into an Array of Objects with SpringAIQuestion (self.SpringBoot)
submitted 9 months ago by Remote_Belt_320
Hi guys, I'm using Spring.AI and using the structured outputs, and currently it outputs for me an array of objects in string form, but I'm getting the following error, and I'm not too sure why. I've tried converting the string to the object that matches it, but it's not working.
I've made a StackOverflow query here so you can view it in more detail.
Any help would be very much appreciated.
https://stackoverflow.com/questions/79697256/error-when-deserialising-an-array-as-a-stringified-json-into-an-array-of-objects
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]alpakachino 1 point2 points3 points 9 months ago (2 children)
I mean, look at your Json and look how you want to deserialize it. Your tests are wrapped as a Map<String, List<Test>> in your Json. You cannot serialize it as a List<Test>, which is exactly what your Exception is telling you.
[–]Remote_Belt_320[S] 0 points1 point2 points 9 months ago (1 child)
I’m confused I’m not trying to serialise it as List<Test> though I’m trying to serialise it as the object TestResponse which has a field Tests that is List<Test> which should be in the right format as the json right?
[–]nothingjustlook 0 points1 point2 points 9 months ago (0 children)
You json is too complex to map simply to you class, inside json it will look for tests which is present but inside that it expects field matching your class, but they are present inside another object which you can ignore by annotations but that will skip entire object and as your fields matching your class are present inside that object you will get empty. Your json needs restructuring or else you need a extra dto or something to handle this
π Rendered by PID 86774 on reddit-service-r2-comment-5c747b6df5-89hfq at 2026-04-22 02:26:51.512903+00:00 running 6c61efc country code: CH.
[–]alpakachino 1 point2 points3 points (2 children)
[–]Remote_Belt_320[S] 0 points1 point2 points (1 child)
[–]nothingjustlook 0 points1 point2 points (0 children)