Android Question JSON deserialize

TheRealMatze

Active Member
Licensed User
Hi,
i have a very simple json - but i´m unable to deserialize it. Everytime i run in errors, can someone help me please.
My json looks like this:

JSON:
{
    "base": [{
            "entry": "name",
            "id": "1a",
            "info": [{
                "entry": "name",
                "id": "1aa"
            }, {
                "entry": "name",
                "id": "1ab"
            }]
        },
        {
            "entry": "name",
            "id": "1b",
            "info": [{
                "entry": "name",
                "id": "1ba"
            }, {
                "entry": "name",
                "id": "1bb"
            }]
        }
    ]
}

I need all values to put it into a database.

Thanks
Matze
 

DonManfred

Expert
Licensed User
Longtime User
B4X:
Dim parser As JSONParser
parser.Initialize(<text>)
Dim root As Map = parser.NextObject
Dim base As List = root.Get("base")
For Each colbase As Map In base
 Dim entry As String = colbase.Get("entry")
 Dim id As String = colbase.Get("id")
 Dim info As List = colbase.Get("info")
 For Each colinfo As Map In info
  Dim entry As String = colinfo.Get("entry")
  Dim id As String = colinfo.Get("id")
 Next
Next

Use this helper:
 
Upvote 2

DonManfred

Expert
Licensed User
Longtime User
Oh, there is a helper
Since YEARS :D

Since 2013 to be honest:
 
Upvote 0
Top