javascript - Why java Path.Separator in JSON file format is switched to \? -


I want to keep a photo path in json object and pass it in javascript in java

< Pre> JSONObject property = new JSONObject (); Assets.put ("Media", PropertyLoader.getStringValue ("PICTURE_DIRECTORY") + "/" + leventPhoto.getFile () .GetName ());

When I find it in jsp file in javascript, it looks like:

  "media": "c: \ / users \ / joao \ /workspace\/.metadata\/.plugins\/org.eclipse.wst.server.core\/tmp1\/wtpwebapps\/RememberMeServer\/images\/02.jpg " 

What can I do to prepare the separator inside JSONObject displayed in javascript?

The data inside Javascript is read , it will have a proper name. This is just the escape sequence, which does not change the value of the data. For example, in a JavaScript console:

  var x = "foo / / bar"; Var y = "afu / bar"; X == y // true  

I am surprised that the forward slash is being escaped - just "C: / Users / joao / ... work fine - but it should not make any difference to the actual value.


Comments