0

I have a class A and I wanted to set the value to the object after that convert the same to json string using object mapper . The problem here is the string that I am setting has to starts with escape char ("\") as shown below . Actual value I wanted to set is "\/Date(1457540067076-0500)\/" .

Please provide me any guidance or example

A obj = new A();
obj.setTransationDateTime("\/Date(1457540067076-0500)\/");  == Compilation Problem 
obj.setTransationDateTime("\\/Date(1457540067076-0500)\\/"); == Json Object is setting value to "\\/Date(1457540067076-0500)\\/" instead of "\/Date(1457540067076-0500)\/"
Sanjeev
  • 9,876
  • 2
  • 22
  • 33
Sivanagaiah
  • 153
  • 3
  • 10
  • Can we see the class definition of `A`? – MC Emperor Aug 16 '16 at 13:13
  • Simple Class with attribute and setter & getter . public class A{ private String tranasactionDate; public String getTranasactionDate() { return tranasactionDate; } public void setTranasactionDate(String tranasactionDate) { this.tranasactionDate = tranasactionDate; } } – Sivanagaiah Aug 16 '16 at 13:24

0 Answers0