AnsweredAssumed Answered

Escaping double quotes for a Json response within Policy Manager

Question asked by UoC on Oct 7, 2015
Latest reply on Oct 7, 2015 by UoC

Hi.

 

I am using a Perform JDBC Query which returns a description from the database into a context variable ${jdbcQuery.description}

 

I include this in a JSON response, however, there are issues when there are double quotes in the description that are not escaped.

 

What's the best way to escape these (e.g.  \" ) using the Policy Manager Assertions. I have tried using the Evaluate Regular Expression but not sure if I can do this.

 

e.g. when the contents of my context variable ${jdbcQuery.description} is

This is my "Example" description


I would replace this with

This is my \"Example\" description


The only other way I can think of is that I do a split variable on " and then a join variable using \" but would this be performance 'costly'?


I would appreciate advise/help.


Many Thanks,

Paul

Outcomes