How to remove underscores from json key value

Viewed 3426

I have a json file like

{
"Asian_Cities_Countries":[
{"name":"Beijing",
"country":"China"
},
{"name":"Ankara",
"country":"Turkey"
}
],
"European_Cities_Countries":[
{"name":"Paris",
"country":"France"
},
{"name":"Madrid",
"country":"Spain"
}
]
}

It is just a part of a json file the actual json is quite big. I am fetching this json through angularjs and displaying it my html page as

    <div class="panel-group" id="accordion">
            <div ng-repeat="key in notSorted(items) track by $index" class="panel panel-default menu-panel" ng-init="value = items[key]" style="margin-bottom:10px;">
            <a data-toggle="collapse" data-parent="#accordion" id="menu-link" href="#{{key}}">
                <div class="panel-heading panel-types">
                    <h4 class="panel-title">
                    {{key}}
  </h4>
                </div></a>
                <div id="{{key}}" class="panel-collapse collapsing menu-items">
                    <div ng-repeat="item in value">
                        <div class="row">
                            <div class="col-sm-12 col-lg-3">
                                <p class="item-name">
                                {{item.name}}
                                </p>
                            </div>
                            <div class="col-sm-12 col-lg-3">
                                <p>{{item.country}}</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

Now I want to remove underscores from the key value and replace it with blank spaces.How do i do it.

I tried {{key.replace('_',' ')}} . But it removes only the first underscore and not all of them.

4 Answers
Related