JSON generator / parser seems to convert maps' keys to string:
log:
0 3 java.lang.String
0 3 java.lang.Integer
1 2 java.lang.String
1 2 java.lang.Integer
2 1 java.lang.String
2 1 java.lang.Integer
Am I doing something wrong or is it so?
B4X:
Dim mapSource As Map
mapSource.Initialize
Dim i As Int
For i = 1 To 3
mapSource.Put(i,i)
Next
Dim jg As JSONGenerator
jg.Initialize(mapSource)
Dim sJSON As String = jg.ToString
Dim jp As JSONParser
jp.Initialize(sJSON)
Dim mapOther As Map = jp.NextObject
For i = 0 To mapOther.Size - 1
Log(i & TAB & mapOther.GetKeyAt(i) & TAB & GetType(mapOther.GetKeyAt(i)))
Log(i & TAB & mapOther.GetValueAt(i) & TAB & GetType(mapOther.GetValueAt(i)))
Next
log:
0 3 java.lang.String
0 3 java.lang.Integer
1 2 java.lang.String
1 2 java.lang.Integer
2 1 java.lang.String
2 1 java.lang.Integer
Am I doing something wrong or is it so?