So, I am trying to send a post with JSON string, which is generated as follows:
so the actual JSON that is generated is:
With additional "\" forward slash at the end of each "/"
Why does this happen? Is this a formatting issue?
B4X:
'{
' "writes": [
' {
' "update": {
' "name": "projects/fall-detection-deep-learning/databases/(default)/documents/users/1",
' "fields": {
' "key 1": {
' "stringValue": "String val 1"
' }
' }
' }
' }
' ]
'}
'Request
Dim request As String= _
"https://firestore.googleapis.com/v1/projects/fall-detection-deep-learning/databases/(default)/documents:commit?prettyPrint=true&key=" _
&Token
Dim name=$"projects/fall-detection-deep-learning/databases/(default)/documents/${Collections}/${Document}"$ As String
'Add JSON
Dim json As JSONGenerator
Dim mapWrite As Map=CreateMap("update": _
CreateMap("name": name, _
"fields": CreateMap("fall": DateTime.Now)))
Dim lstWrites As List:lstWrites.Initialize
lstWrites.Add(mapWrite)
Dim mapData=CreateMap("writes": lstWrites) As Map
json.Initialize(mapData)
Log("Data to send:")
Log(json.ToString)
so the actual JSON that is generated is:
B4X:
{"writes":[{"update":{"name":"projects\/fall-detection-deep-learning\/databases\/(default)\/documents\/users\/1","fields":{"fall":1580222596745}}}]}
With additional "\" forward slash at the end of each "/"
Why does this happen? Is this a formatting issue?