A Aysic4Bandroid Member Licensed User Longtime User Jul 23, 2012 #1 hi, Can anyone clarify how i access an array inside another array in a JSON string - i know this is how to reference the outer array in the first index: Code: Copy map1 = list1.Get(0) If this array index contains another nested array (rather than an object) can i access it thus: Code: Copy map1 = list1.Get(0)(0) If not, what is the correct way an object such as this in a JSON string maps to a b4A List thanx :sign0163:
hi, Can anyone clarify how i access an array inside another array in a JSON string - i know this is how to reference the outer array in the first index: Code: Copy map1 = list1.Get(0) If this array index contains another nested array (rather than an object) can i access it thus: Code: Copy map1 = list1.Get(0)(0) If not, what is the correct way an object such as this in a JSON string maps to a b4A List thanx :sign0163:
Erel B4X founder Staff member Licensed User Longtime User Jul 23, 2012 #2 This is not really a multidimensional array. Actually it is a list that holds a single dimension arrays: Code: Copy Dim arr() As String arr = list1.Get(0) log(arr(7)) Upvote 0
This is not really a multidimensional array. Actually it is a list that holds a single dimension arrays: Code: Copy Dim arr() As String arr = list1.Get(0) log(arr(7))
A Aysic4Bandroid Member Licensed User Longtime User Jul 23, 2012 #3 Erel, Ok excuse my use of the word multidimensional - but i see them as such even though they are really 'lists' in b4A - So how do i get to the list within the first index - ive attached a 'JSON 2 HTML' generated diagram to help visualize my json string: In your tutorial on JSON someone asked a similar question and you gave them code similar to that included in my original thread - that helps me access the first Object (index 0) my question now is what is the syntax to reference and iterate over inner array which all have the same format ?? do i need to DIM two separate lists and two maps. Attachments JSON-2-HTML.png 38.5 KB · Views: 697 Upvote 0
Erel, Ok excuse my use of the word multidimensional - but i see them as such even though they are really 'lists' in b4A - So how do i get to the list within the first index - ive attached a 'JSON 2 HTML' generated diagram to help visualize my json string: In your tutorial on JSON someone asked a similar question and you gave them code similar to that included in my original thread - that helps me access the first Object (index 0) my question now is what is the syntax to reference and iterate over inner array which all have the same format ?? do i need to DIM two separate lists and two maps.
A Aysic4Bandroid Member Licensed User Longtime User Jul 23, 2012 #4 Hello! Anyone!! any ideas so i don't have to re-post for the 3rd time Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jul 23, 2012 #5 any ideas so i don't have to re-post for the 3rd time Click to expand... I'm afraid that you will need to be more patient... If I understand correctly from the image, your main list includes two items. The second item (in index 1) is another list that holds several Maps. You should declare an additional list object and then set it with the value of MainList.Get(1). Upvote 0
any ideas so i don't have to re-post for the 3rd time Click to expand... I'm afraid that you will need to be more patient... If I understand correctly from the image, your main list includes two items. The second item (in index 1) is another list that holds several Maps. You should declare an additional list object and then set it with the value of MainList.Get(1).
A Aysic4Bandroid Member Licensed User Longtime User Jul 23, 2012 #6 Thanks for that - i was completely on the wrong tracks my apologies Erel - didn't mean to appear hasty - just got caught up with with one i keep hitting brick walls in the learning of how things work in B4a - just frustration (with myself mainly). Upvote 0
Thanks for that - i was completely on the wrong tracks my apologies Erel - didn't mean to appear hasty - just got caught up with with one i keep hitting brick walls in the learning of how things work in B4a - just frustration (with myself mainly).