iOS Code Snippet JSON to Map Convesion

Discussion in 'iOS Code Snippets' started by Mashiane, May 27, 2015.

  1. Mashiane

    Mashiane Expert Licensed User

    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..

    Code:
    Sub JsonToMap(strJSON As StringAs 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
     
    ShaneG30 and victormedranop like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice