Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Trouble retrieving Values from JSON object

Trouble retrieving Values from JSON object

Trouble retrieving Values from JSON object

I found some code, hacked it up managed to retrieve a JSON object from a particular site but I can't seem to manage wrapping my mind around what the objects/members are for retrieving data... There is an attribute in basicinfo that I would like (as well as one more if I can find it) but in looking at the watch and the returned hierarchy, I never could manage to figure out how to retrieve anything. This one stumps me. I never did like playing with Java Script... I can see this one right, I can probably figure others out. Ironically the sample I swiped this from does not seem to work entirely and does not show its object hierarchy in watch window.
Am I missing a function that retrieves attributes or am I just too dense to get the syntax right? In any case please show me the way.


Sub ReadNPIData(strNPI)
    'To find a a sample NPI goto:
    ' https://npiregistry.cms.hhs.gov/
    ' Enter information like first and last name and state of your doctor
    ' Hit search
    Dim NPIRequest As Object
    Dim scriptControl As Object
    Dim JsonObject As Object
    Set scriptControl = CreateObject("MSScriptControl.ScriptControl")
    scriptControl.Language = "JScript"

    With CreateObject("MSXML2.XMLHTTP")
        .Open "GET", "https://npiregistry.cms.hhs.gov/api/?number=" & strNPI & "&enumeration_type=&taxonomy_description=&first_name=&last_name=&organization_name=&address_purpose=&city=&state=&postal_code=&country_code=&limit=&skip=", False
        Set NPIRequest = scriptControl.Eval("(" + .responsetext + ")")
        Stop 'Put Watch on NPIRequest you can view elements... Syntax is eluding me for retrieving elements
             'Clearly it can return a hierarchy
        Debug.Print NPIRequest.Items(1).Number 'just one of several failures I tried this one exudes my frustration
    End With

End Sub 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close