VBA-tools / VBA-JSON

JSON conversion and parsing for VBA
MIT License
1.76k stars 568 forks source link

JSON import into Access using JSONConverter.bas code to accomodate my JSON file? #214

Open meekacorn opened 2 years ago

meekacorn commented 2 years ago

211129_QuestionJSON.xlsx

b_jsonfile.txt

Hi

I have been trying to figure out how to import a JSON file directly into Access.   I found this link https://stackoverflow.com/questions/30510570/parsing-json-feed-automatically-into-ms-access and was able to follow along and import a json file into an access database using the first responder's (Parfait's) guidance/provided table example.  Their table was very simplified.  His guidance had me importing your jsonconverter.bas file into my access database. I also imported your dictionary.cls into my access database   When I try to import json with my more complex json file I get a "runtime error '438': Object doesn't support this property or method".  On line 28 of my code (built using Parfait's code from his simpler example), "For each element in p", when I hover it shows "Element=Empty".  I highlighted in yellow where this happens in the attached excel file.   I thought it may be due to the json file I pulled not having the straight square brackets at the beginning and end (it only has curly brackets for each entry) but adding them to my import file does not clear the error.  I am hopeful you are able to look at my code and spot what the issue is.  It is most definitely on my end so I am hopeful it is OK that I am reaching out for help.  The file I am looking to import is massive and its row capacity exceeds Excel otherwise I would reformat it for Access in Excel.   I do have the Microsoft Scripting Run Time enabled.  My Access version is 2019 though the modules must cause it to show as Access 2007-2016 File Format.   I am attaching an excel file that has my code and the Access database table structure I built for the JSON data I want to import.   I am also attaching a text version of the JSON file I am trying to import (only a handful of records not the entire download), I couldn't attach a JSON file.

Thank you for any help!

aholden10 commented 2 years ago

I don't know anything about using the VBA tools in Access or whatever, but the JSON text that you included doesn't parse properly in any of the online validators or beautifiers that I pasted it into (and you already seem to know the JSON isn't valid). Making sure your JSON is valid seems like the proper first step otherwise the VBA tools can not operate correctly.

That would be my troubleshooting route anyway...  On Monday, November 29, 2021, 10:09:18 PM EST, meekacorn @.***> wrote:

211129_QuestionJSON.xlsx

b_jsonfile.txt

Hi

I have been trying to figure out how to import a JSON file directly into Access.   I found this link https://stackoverflow.com/questions/30510570/parsing-json-feed-automatically-into-ms-access and was able to follow along and import a json file into an access database using the first responder's (Parfait's) guidance/provided table example.  Their table was very simplified.  His guidance had me importing your jsonconverter.bas file into my access database. I also imported your dictionary.cls into my access database   When I try to import json with my more complex json file I get a "runtime error '438': Object doesn't support this property or method".  On line 28 of my code (built using Parfait's code from his simpler example), "For each element in p", when I hover it shows "Element=Empty".  I highlighted in yellow where this happens in the attached excel file.   I thought it may be due to the json file I pulled not having the straight square brackets at the beginning and end (it only has curly brackets for each entry) but adding them to my import file does not clear the error.  I am hopeful you are able to look at my code and spot what the issue is.  It is most definitely on my end so I am hopeful it is OK that I am reaching out for help.  The file I am looking to import is massive and its row capacity exceeds Excel otherwise I would reformat it for Access in Excel.   I do have the Microsoft Scripting Run Time enabled.  My Access version is 2019 though the modules must cause it to show as Access 2007-2016 File Format.   I am attaching an excel file that has my code and the Access database table structure I built for the JSON data I want to import.   I am also attaching a text version of the JSON file I am trying to import (only a handful of records not the entire download), I couldn't attach a JSON file.

Thank you for any help!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.