SOLVED.
Of course the above code did not work! I applied .replaceAll
before making the string manipulation! That said, convert the json
object into array, do the string manipulation and then apply .replaceAll
.
.then(function(json) {
// convert the json object into array
var items = [];
for (var i in json.settings) {
items.push(json.settings[i])
}
// get the value from the array and apply the string manipulation
a = items[0].announce;
items[0].announce = a.replace("\\n", "\n");
// apply .replaceAll
fetchedData.replaceAll(items);
})
<Text>
will correctly apply line breaks when the string is fetched from a remote server.