Replace response values or characters

Updated at May 6th, 2020

You can replace characters or entire response values by using the "replace" attribute in the JSON editor. 


This is particularly useful for instances where you want to replace a certain character, word or phrase throughout all response values. In the example below a � character appears throughout some of the response values. Sometimes when datasets are imported into Protobi certain characters can appear this way.  

You can add the "replace" attribute in the JSON editor to insert a different character at every instance of "�".

This attribute can also perform a similar function as the Recode... dialog. You can use the "replace" attribute to replace entire values like changing "Whatever they want" to "anything". 

"replace" : {
    "�" : "/",
    "Whatever they want" : "anything"

The � character throughout Q24 has been replaced with "/" and the response value "Whatever they want" has been replaced as well. 


This method works to replace underlying values. Using the "replace" attribute will not work to replace words or characters in the element's format

Was this article helpful?