I have simple REST Controller (in Kotlin) method with @RequestBody
object.
@PostMappging(...)
fun postTestFunction(@RequestBody data: ExampleObject) {
...
}
Where ExampleObject is:
class ExampleObject(
@JsonProperty("paramOne")
val paramOne: Map<String, Int>,
@JsonProperty("paramTwo")
val paramTwo: String
)
That request can be send with next body:
{
"paramOne": {
"test": 1 // Here I can write any number of Map<String, Int>
},
"paramTwo": "test"
}
But I need another request body something like this:
{
"test": 1, // I need any number of Map<String, Int> without field name "paramOne"
"paramTwo": "test"
}
What should I do to send request body with Map field (String, Int) but without field name?