Reputation: 508
I have class like:
export class LogModel {
..
componentSet: Set<string>;
constructor(componentSet: Set<string>) {
this.componentSet = componentSet;
}
And I need to post this class to Spring boot app. But I have the problem with JSON deserialization because:
And I have to use transform method like
`private toArray(set) {
let array: string[] = [];
for (let i = 0; i < set.length; ++i)
array[i] = set[i];
return array;
}`
in order to have How to properly POST this class?
Upvotes: 0
Views: 322
Reputation: 1605
Do like this before sending to post method
const postValue = Array.from(this.componentSet);
(OR)
const setValues = this.componentSet.values();
const postValue = Array.from(setValues);
Then post the postValue
Upvotes: 1