I need help to parse this JSON
I've tried
I need to extract value for cat_id, cat_name, name, url. I've tried to follow this one but failed. :sign0085:
B4X:
{
"categories": [
{
"cat_id": "16",
"cat_name": "Arm Locks",
"posts": [
{
"name": "Flying Armbar",
"url": "http://www.youtube.com/watch?v=p_xxxxx"
},
{
"name": "Roll Over",
"url": "http://www.youtube.com/watch?v=xxxxxx"
},....
I've tried
B4X:
Dim JSON As JSONParser
Dim Map1 As Map
JSON.Initialize(File.ReadString(File.DirAssets, "vid.json"))
Map1 = JSON.NextObject
Dim m As Map 'helper map for navigating
Dim MenuItems As List
m = Map1.Get("categories")
MenuItems = m.Get("posts")
For i = 0 To MenuItems.Size - 1
m = MenuItems.Get(i)
Log(m.Get("name"))
Next
Last edited: