Easiest way to parse JSON data

I am playing around and still very new to Xojo. I had read different docs on this but still a bit confused how to parse the childs from a JSON results data.

For example I pull the JSON data via HTTPSocket
I am able to view the JSON data on the screen but how would I for example display only fro the API results the “title” which is under the child results. So my question in summary: How using the API call in the below example would I parse the results and get a list of only the titles. Thanks

I was playing around with some different examples on the Xojo examples and Xojo books section but still cant seem to get this knocked out.

Dim socket1 As New HTTPSocket
Dim jsonData As String = socket1.Get(“http://api.nytimes.com/svc/search/v1/article?query=god&api-key=629a39d0768609d31fee424b52fbb704%3A5%3A64325990&.format=json”, 30)

Dim apiResponse as new JSONItem(jsonData)

TextArea1.Text = apiResponse.ToString

Try this;

  Dim socket1 As New HTTPSocket
  Dim jsonData As String = socket1.Get("http://api.nytimes.com/svc/search/v1/article?query=god&api-key=629a39d0768609d31fee424b52fbb704%3A5%3A64325990&.format=json", 30)
  
  Dim apiResponse as new JSONItem(jsonData)

  dim results as JSONItem = apiResponse.child("results")
  dim n as JSONItem
  dim titles() as string
  dim i as integer
  
  for i = 0 to results.count-1
    n= results.child(i)
    titles.append n.value("title")
  next

@Tim Hare Awesome brother, that worked perfect. I was able to load the titles() array directly into my listbox. Works like a charm :slight_smile: