Contact US

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!

*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

VB6 Parsing JSON

VB6 Parsing JSON

VB6 Parsing JSON

Are there any native ways to parse JSON in VB6?

I have the following JSON string and would like to parse it. These will be dynamic as I am pulling from a API.


{"result_count":1, "results":[{"taxonomies": [{"state": "NY", "code": "207R00000X", "primary": true, "license": "999999", "desc": "Internal Medicine"}], "addresses": [{"city": "ALBANY", "address_2": "SUITE 999", "telephone_number": "999-999-9999", "state": "NY", "postal_code": "122056433", "address_1": "5 XXXXXXX DR", "country_code": "US", "country_name": "United States", "address_type": "DOM", "address_purpose": "LOCATION"}, {"city": "ALBANY", "address_2": "SUITE 200", "telephone_number": "518-438-0019", "state": "NY", "postal_code": "122056433", "address_1": "5 PALISADES DR", "country_code": "US", "country_name": "United States", "address_type": "DOM", "address_purpose": "MAILING"}], "created_epoch": 1308182400, "identifiers": [], "other_names": [], "number": 1346535499, "last_updated_epoch": 1414540800, "basic": {"status": "A", "credential": "D.O.", "first_name": "TEST", "last_name": "IT", "middle_name": "X", "name": "TEST IT", "gender": "M", "sole_proprietor": "NO", "last_updated": "2014-10-29", "enumeration_date": "2011-06-16"}, "enumeration_type": "NPI-1"}]} 



RE: VB6 Parsing JSON

Did you have any luck finding anything in json.org?
There is a link at the bottom of the page to VB-JSON

---- Andy

There is a great need for a sarcasm font.

RE: VB6 Parsing JSON

Hi, yes, just downloaded that. Now just trying to get down the syntax for parsing out the information in the JSON. Having some difficulty with that. Thanks.


RE: VB6 Parsing JSON

Getting items in the JSON is giving me issues. Top level items I am grabbing just fine.


sRequest = "https://npiregistry.cms.hhs.gov/api?first_nameADAM&last_name=LAMMLY&state=NY&limit=1&skip="
        'Assumed MSXML2 core service well installed
        Set oxmlhttp2 = New MSXML2.ServerXMLHTTP
        oxmlhttp2.Open "get", sRequest, False
        oxmlhttp2.setRequestHeader "Content-Type", "application/json"
        oxmlhttp2.send sRequest
        Set oXMLDoc2 = New MSXML2.DOMDocument
        oXMLDoc2.async = False
        If oxmlhttp2.readyState = 4 Or oxmlhttp2.Status = 200 Then
          result = oXMLDoc2.loadXML(oxmlhttp2.responseText)
          result = False
        End If
        MsgBox oxmlhttp2.responseText

        Dim p As Object
        Set p = JSON.parse(oxmlhttp2.responseText)
        MsgBox "Result Count: " & p.Item("result_count")
        MsgBox "Results Taxonomies State: " & p.Item("results").Item("taxonomies").Item("state") 


RE: VB6 Parsing JSON

I think I got it.


MsgBox "Result Count: " & p.Item("result_count")
        MsgBox "Results City: " & p.Item("results").Item(1).Item("addresses").Item(1).Item("city")
        MsgBox "Results State: " & p.Item("results").Item(1).Item("addresses").Item(1).Item("state")
        MsgBox "Results State: " & p.Item("results").Item(1).Item("addresses").Item(1).Item("postal_code") 


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