File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
core/src/main/python/wlsdeploy/json Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -248,8 +248,7 @@ def _format_json_value(value):
248248
249249def _escape_text (text ):
250250 """
251- Escape the specified text for use in a double-quoted string.
252- Escape embedded double quotes with a backslash.
251+ Escape the specified text for use in a double-quoted string to become valid json expression.
253252 :param text: the text to escape
254253 :return: the escaped text
255254 """
@@ -259,4 +258,16 @@ def _escape_text(text):
259258 result = text .replace ('\\ ' , '\\ \\ ' )
260259 if '"' in text :
261260 result = text .replace ('"' , '\\ "' )
261+ if '\n ' in text :
262+ result = text .replace ("\n " , "\\ \\ n" )
263+ if '\b ' in text :
264+ result = text .replace ("\b " , "\\ \\ b" )
265+ if '\f ' in text :
266+ result = text .replace ("\f " , "\\ \\ f" )
267+ if '\r ' in text :
268+ result = text .replace ("\r " , "\\ \\ r" )
269+ if '\t ' in text :
270+ result = text .replace ("\t " , "\\ \\ t" )
271+ if '\/' in text :
272+ result = text .replace ("\/" , "\\ \\ /" )
262273 return result
You can’t perform that action at this time.
0 commit comments