cerialize
cerialize copied to clipboard
is it works with HttpClient ?
Hi, I'm using HttpClient from Angular 6 and I would like to use your librairie to transform snakecase to camelcase but it's doesn't works...
My Model :
export class Set {
@autoserializeAs('set_id') setId: string;
@serialize year: number;
@serialize number: number;
@serialize theme: string;
@serialize name: string;
@serialize image: string;
}
My service :
getSet(setId): Observable<Set> {
return this.httpClient.get<Set>(this.setsUrl + setId + '/');
}
is it possible or not ???
I don't know anything about HttpClient or Angular but I don't see why it wouldn't work. You probably need to actually call Serialize/Deserialize though, your sample doesn't invoke Cerialize
it works, amazing script dude keep up the good work 😄
you can close close the issue now
@Calion54 you can call map
operator to deserialize. I suppose Set
is you data class.
getSet(setId): Observable<Set> {
return this.httpClient.get<JsonObject>(this.setsUrl + setId + '/')
.pipe(map(data => Deserialize<Set>(data, Set)));
}