Get a value from Json object

GoJakie

Board Regular
Joined
Dec 1, 2007
Messages
176
I dont know if this is possible in excel and need your advice. If I enter the below url in the browser,I get a Json object with a "is_verified" parameter either true or false.
https://graph.facebook.com/fql?q=SELECT is_verified FROM page WHERE username="nokia"
This is what i get
Code:
{
   "data": [
      {
         "is_verified": true
      }
   ]
}
The above link has a nokia pagename, In excel, in the range A1:A782, I have list of facebook pagename, Is it possible to get the status via Json object in excel vba?
 

Some videos you may like

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Kyle123

Well-known Member
Joined
Jan 24, 2012
Messages
2,708
Yes, just send a request in the normal way and use instr to test if "true" is in the response
 

GoJakie

Board Regular
Joined
Dec 1, 2007
Messages
176
trying a lot but no success
Code:
Function Verify(sPagename As String) As String

  Static oHTTP As WinHttpRequest
  sURL="https://graph.facebook.com/fql?q=SELECT is_verified FROM page WHERE username=" & sPagename

  If oHTTP Is Nothing Then Set oHTTP = New WinHttpRequest

  On Error GoTo Oops
  With oHTTP
    .Open "GET", sURL
    .Send

what do i do here ??????

    Exit Function
  End With

Oops:
  Verify = False
End Function
 

Kyle123

Well-known Member
Joined
Jan 24, 2012
Messages
2,708
Code:
Function Verify(sPagename As String) As Boolean


  Static oHTTP As WinHttpRequest
  sURL="https://graph.facebook.com/fql?q=SELECT is_verified FROM page WHERE username=" & sPagename


  If oHTTP Is Nothing Then Set oHTTP = New WinHttpRequest


  On Error GoTo Oops
  With oHTTP
    .Open "GET", sURL, FALSE
    .Send
    if instr(.responseText, "true") > 0 then Verify = True
what do i do here ??????


    Exit Function
  End With


Oops:
  Verify = False
End Function
 

GoJakie

Board Regular
Joined
Dec 1, 2007
Messages
176
It was still not giving the correct result after checking it once again, I found a silly mistake in defining the sURL
The correct way was sURL = "https://graph.facebook.com/fql?q=SELECT is_verified FROM page WHERE username=" & "'" & sPagename & "'"

Issue resolved. Thanks for your help
 

Watch MrExcel Video

Forum statistics

Threads
1,122,955
Messages
5,599,040
Members
414,280
Latest member
morralletti

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top