I'm having trouble with a map created from a parsed JSON string. See the code below.
Here is the value for LastEntryRecord.
After trying to remove the "entered" key, it is still there. If I copy the string from the log and put it directly into the code where LastEntryRecord is used to initialize the parser, it works. Any ideas?
B4X:
'executed from javascript
Sub ShowSleepLog(Record As String, LastEntryRecord As String)
#if b4i
Dim su As StringUtils
Record=su.DecodeUrl(Record,"UTF8")
LastEntryRecord=su.DecodeUrl(LastEntryRecord,"UTF8")
#end if
LogColor(Record,0xFFC67E13)
LogColor("Last entry: "&LastEntryRecord,0xFF8300FF)
'parse out the last entry record if there is one
If LastEntryRecord.Length>0 Then
Dim j As JSONParser
j.Initialize(LastEntryRecord) '
Dim m As Map = j.NextObject
' m.Remove("entered")
Log("m.ContainsKey" & m.ContainsKey("entered"))
Task_sleeplog.LastEntryRecordMap=m
Task_sleeplog.LastEntryRecordMap.Remove("entered")
Log(Task_sleeplog.LastEntryRecordMap.ContainsKey("entered"))
End If
End Sub
Here is the value for LastEntryRecord.
B4X:
{"bedtime":"07:28","uptime":"15:28","sleeponsetmins":5,"wasomins":13,"awakeningscount":3,"qualityrating":2,"morningfeelingrating":null,"sadnessrating":0,"stressrating":0,"medsused":null,"medname":null,"comment":null,"id":"ext-record-119","tib":8,"tst":7.7,"se":96,"entered":"2019-09-10T00:00:00","updated":"2019-09-10T15:29:22","authenticatedUserId":8,"create":false,"update":false,"remove":false,"remoteid":24041}
After trying to remove the "entered" key, it is still there. If I copy the string from the log and put it directly into the code where LastEntryRecord is used to initialize the parser, it works. Any ideas?
Last edited: