I am facing an issue with fetching data through an API. The JSON data format contains Turkish characters and spaces, causing problems when trying to display the data in a datatable. I have attempted to use the replace and parse functions, but so far, I have been unsuccessful.
Original JSON format:
{
"Kod Adı": "USD",
"Alış Kür": "12.4448"
},
{
"Kod Adı": "AUD",
"Alış Kür": "8.8412"
},
{
"Kod Adı": "DKK",
"Alış Kür": "1.8851"
},
{
"Kod Adı": "EUR",
"Alış Kür": "14.0385"
},
{
"Kod Adı": "GBP",
"Alış Kür": "16.5046"
},
Desired JSON format:
{
"KodAdi": "USD",
"AlisKur": "12.4448"
},
{
"KodAdi": "AUD",
"AlisKur": "8.8412"
},
{
"KodAdi": "DKK",
"AlisKur": "1.8851"
},
{
"KodAdi": "EUR",
"AlisKur": "14.0385"
},
{
"KodAdi": "GBP",
"AlisKur": "16.5046"
},
In addition to this, I am encountering a CORS policy error.
The request from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I have tried various methods suggested in this article, but none have yielded positive results.
shared.service.ts
getAnalizor() : Observable<any[]>{
return this.http.get<any>('http://15.12.1.05/analizorJSON.php')
}