Recently, I encountered a small issue with HttpClient when trying to retrieve data from my API:
constructor(private http: HttpClient) {}
ngOnInit(): void {
this.http.get("http://localhost:8080/api/test/test?status=None").subscribe((data)=>{
console.log(data);
})}
It appears that HttpClient is sorting the JSON fields alphabetically. The response in Postman looks like this:
"total": {
"error": 321,
"run": 338,
"desc": 1000
}
Meanwhile, the response from Angular HttpClient looks like this:
total: {
desc: 321,
error: 1000,
run: 338
}
Has anyone else faced this issue or have any tips on how to prevent HttpClient from ordering the fields alphabetically?