1

I have this string in json format

[{
    "EXTENSION" : ".pdf",
    "LINK" : "\\192.168.1.6\Varios\_SERV_IMG\ArchivosSocio\000000006000000006PSO000115-02-2016PDF.pdf"
}]

the problem is when ...

datos = $.parseJSON(res);

as I write \ in a string JSON?

John Slegers
  • 45,213
  • 22
  • 199
  • 169
CMedina
  • 4,034
  • 3
  • 24
  • 39
  • It's not entirely clear what your question or problem is. If you are getting an error, it would be helpful to share it. Other than that, the only suggestion I can make is to escape your JSON data values appropriately. – Brian Driscoll Feb 15 '16 at 17:37
  • 1
    This question is related [JavaScript backslash (\) in variables is causing an error](http://stackoverflow.com/questions/3903488) – t.niese Feb 15 '16 at 17:41
  • The JSON is invalid. You should let the JSON be generated for you, don't create it manually. – Felix Kling Feb 15 '16 at 19:03

1 Answers1

5

The \ needs to be escaped to \\

so:

[{
    "EXTENSION" : ".pdf",
    "LINK" : "\\\\192.168.1.6\\Varios\\_SERV_IMG\\ArchivosSocio\\000000006000000006PSO000115-02-2016PDF.pdf"
}]
Dustin Simpson
  • 749
  • 4
  • 10