How to reference the correct data with parameters

  • I want to reference the correct data using VBA /Json format , for example if I just want to get the details below only NOT all users , but only one user listed below, how can I do it:

    "id": 1,
    "name": "Leanne Graham",
    "username": "Bret",
    "email": "[email protected]",
    "address": {
    "street": "Kulas Light",
    "suite": "Apt. 556",
    "city": "Gwenborough",
    "zipcode": "92998-3874",
    "geo": {
    "lat": "-37.3159",
    "lng": "81.1496"

    Below is my VBA I'm using to pull data, how can it be changed so that it pull only the above person data

    Public Sub exceljson()
    Dim http As Object, JSON As Object, i As Integer
    Set http = CreateObject("MSXML2.XMLHTTP")
    http.Open "GET", "", False
    Set JSON = ParseJson(http.responseText)
    i = 2
    For Each Item In JSON
    Sheets(1).Cells(i, 1).Value = Item("id")
    Sheets(1).Cells(i, 2).Value = Item("name")
    Sheets(1).Cells(i, 3).Value = Item("username")
    Sheets(1).Cells(i, 4).Value = Item("email")
    Sheets(1).Cells(i, 5).Value = Item("address")("city")
    Sheets(1).Cells(i, 6).Value = Item("phone")
    Sheets(1).Cells(i, 7).Value = Item("website")
    Sheets(1).Cells(i, 8).Value = Item("company")("name")
    i = i + 1
    MsgBox ("complete")
    End Sub

  • administrators

    @nector You should change the URL to
    Every API is different but this is the standard format and works for this API

  • Thank you so much

Log in to reply

Looks like your connection to Codingislove Forum was lost, please wait while we try to reconnect.