Android Question JsonPATH

BillMeyer

Well-Known Member
Licensed User
Longtime User
I took a copy of the JSON Goessner offers as an example, used this tool https://b4x.com:51041/json/index.html and got this result:

B4X:
Dim parser As JSONParser
parser.Initialize(<text>)
Dim root As Map = parser.NextObject
Dim store As Map = root.Get("store")
Dim bicycle As Map = store.Get("bicycle")
Dim color As String = bicycle.Get("color")
Dim price As Double = bicycle.Get("price")
Dim book As List = store.Get("book")
For Each colbook As Map In book
 Dim author As String = colbook.Get("author")
 Dim price As Double = colbook.Get("price")
 Dim category As String = colbook.Get("category")
 Dim title As String = colbook.Get("title")
Next

And this is how the tool extracts the JSON

store
  • bicycle
    • color: red
    • price: 19.95
  • book
    • 0
      • author: Nigel Rees
      • price: 8.95
      • category: reference
      • title: Sayings of the Century
    • 1
      • author: Evelyn Waugh
      • price: 12.99
      • category: fiction
      • title: Sword of Honour
    • 2
      • author: Herman Melville
      • price: 8.99
      • isbn: 0-553-21311-3
      • category: fiction
      • title: Moby Dick
    • 3
      • author: J. R. R. Tolkien
      • price: 22.99
      • isbn: 0-395-19395-8
      • category: fiction
      • title: The Lord of the Rings

Hope this helps
 
Upvote 0
Top