I'm getting Json reponse like this,
var optCities = [{
"resultData": {
"Hoteloption": [
{
"CityRating":"[
{'City': 'Bangkok','Rating':4.5},
{'City': 'Phuket','Rating':4.5},
{'City': 'Nonthaburi','Rating':4.5},
{'City': 'Broc','Rating':4.5}]"
}]
}}];
I've tried to create a pipe
transform(value: any, args?: any): any {
var st = JSON.stringify(value);
var result = JSON.parse(st);
return result;
}
first tried to create json object.
but if I console the result variable it still shows string.
<div *ngFor="let city of optCities[0].resultData.Hoteloption[0].CityRating | strReplace ;let i = index; ">
{{city.Rating}}
</div>
What I'm missing?