K.H.Nagaradder
K.H.Nagaradder

Reputation: 71

How json treats if there is a forward slashes in json string

I Have a json string as below:

[
  {
     "NAME" : "KANTESH",
     "SNAME" : "NAGARADDER",
     "MSG1" : "\"HELLO:HOW ARE YOU\"\n",
     "MSG2" : "\"HELLO:///HOW ARE YOU\"\n",
     "ID"   : 20074499
  }
]

when i am trying to remove the white spaces using libjson libarary function i.e json_strip_white_space() i am getting the below resulting string.

[{"NAME":"KANTESH","SNAME":"NAGARADDER","MSG1":"\"HELLO:HOW ARE YOU\"\n","MSG2":"\"HELLO:"ID":20074499}]

In the above resulting string the characters after the '///' are stripped out and concatenated with next line.

Below are my queries:
1)Why the characters after the forward slashes are stripping out.
2)Does json_strip_white_space() treats '///' as comments
3)How to overcome this problem

Please help me. Thanks,

Upvotes: 3

Views: 243

Answers (0)

Related Questions