malvin garabha
Member
i am get an error when i try to cast a value in a map to a boolean variable .
The data is from a JSON string which i parsed into a map and it contains a boolean field.
Here is the code snippet which generates the error:
The error from the logs is this one:
java.lang.RuntimeException: Cannot parse: 1 as boolean
I am new to the B4X language and any help would be appreciated.
The data is from a JSON string which i parsed into a map and it contains a boolean field.
Here is the code snippet which generates the error:
B4X:
Dim parser As JSONParser
Dim JSONCategoriesMap As Map
parser.Initialize(JSONstoredAllCategories)
JSONCategoriesMap=parser.NextObject
Dim categorieslist As List =JSONCategoriesMap.get("categories")
For Each field As Map In categorieslist
Dim categoryactive As Boolean =field.Get("is_active").As(Boolean)
The error from the logs is this one:
java.lang.RuntimeException: Cannot parse: 1 as boolean
I am new to the B4X language and any help would be appreciated.