iOS Code Snippet JSON to Map Convesion

This converts a json string to a map, your json strings should be enclosed with double quotes. Example:

{"path":"encounter between rebekah and isaac.jpg","text":"Encounter Between Rebekah And Isaac"}

This will work even if you have enclosed this in square brackets or not..

B4X:
Sub JsonToMap(strJSON As String) As Map

    ' convert a json string to a map
    Dim jMap As Map
    jMap.Initialize
    Dim JSON As JSONParser
    JSON.Initialize(strJSON)
    jMap = JSON.NextObject
    Return jMap
End Sub
 
Top