ironfelix717
Registered User.
- Local time
- Today, 10:04
- Joined
- Sep 20, 2019
- Messages
- 193
Applauding computer science --- we've actually counterproductively made what is supposed to be a universal data structure into a PITA to use.
I am trying to use the bloated JSON parser to grab a value from a JSON string.
Frankly, I don't understand dictionaries that well. And now were gonna nest them - sweet.
Here is the JSON (unformatted crap):
And here is my code using the JSON parser: (Tim Halls Code: https://github.com/VBA-tools/VBA-JSON)
This gives...
I need to be able to grab the values of these properties! How do I do this.
Thanks
I am trying to use the bloated JSON parser to grab a value from a JSON string.
Frankly, I don't understand dictionaries that well. And now were gonna nest them - sweet.
Here is the JSON (unformatted crap):
Code:
{"request_info":{"success":true},"account_info":{"api_key":"NoneUrBiz","name":"Johnson","email":"fruit@gmail.com","plan":"Starter","credits_used":3,"credits_remaining":9997,"credits_reset_at":"2022-02-20T22:19:27.000Z","credits_limit":10000,"zipcodes_used":0,"zipcodes_limit":1,"zipcodes_available":1,"account_balance_usd":0,"account_balance_message":"Your Account Balance is used to pay any Overage charges (to avoid multiple small transactions being made to your payment card). You can top up your Account Balance on the Account page of the Dashboard. Your Account Balance is not used for your monthly Plan payment.","destinations_used":0,"destinations_limit":50,"destinations_available":50,"overage_allowed":true,"overage_enabled":false,"overage_limit":20000,"overage_used":0,"collections_used":0,"collections_limit":10000,"collections_available":10000,"usage_history":[{"month":"January","year":2022,"month_number":1,"is_current_month":true,"credits_total_for_month":3,"credits_total_per
_day":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":3,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0}},{"month":"December","year":2021,"month_number":12,"is_current_month":false,"credits_total_for_month":0,"credits_total_per_day":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0}},{"month":"November","year":2021,"month_number":11,"is_current_month":false,"credits_total_for_month":0,"credits_total_per_day":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0}},{"month":"October","year":2021,"month_number":10,"is_current_month":false,"credits_total_for_month":0,"credits_total_per_day":{"1":0,"2":
0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0}}],"status":[{"component":"Search Requests","description":"Status of CnodeAPIDataSystems 'type=search' requests","group":"Parsing","status":"operational"},{"component":"Product Requests","description":"Status of CnodeAPIDataSystems 'type=product' requests","group":"Parsing","status":"operational"},{"component":"Offers Requests","description":"Status of CnodeAPIDataSystems 'type=offers' requests","group":"Parsing","status":"operational"},{"component":"Stock Estimation Requests","description":"Status of CnodeAPIDataSystems 'type=stock_estimation' requests","group":"Parsing","status":"operational"},{"component":"Reviews Requests","description":"Status of CnodeAPIDataSystems 'type=reviews' requests","group":"Parsing","status":"operational"},{"component":"Bestmanagers Requests","description":"Status of CnodeAPIDataSystems 'type=bestmanagers' requests","group":"Parsing","sta
tus":"operational"},{"component":"Questions Requests","description":"Status of PULLTERM 'type=questions' requests","group":"Parsing","status":"operational"},{"component":"Category Requests","description":"Status of CnodeAPIDataSystems 'type=category' requests","group":"Parsing","status":"operational"},{"component":"Also Bought Requests","description":"Status of CnodeAPIDataSystems 'type=also_bought' requests","group":"Parsing","status":"operational"},{"component":"manager Profile Requests","description":"Status of CnodeAPIDataSystems 'type=manager_profile' requests","group":"Parsing","status":"operational"},{"component":"Deals Requests","description":"Status of CnodeAPIDataSystems 'type=deals' requests","group":"Parsing","status":"operational"},{"component":"Autocomplete Requests","description":"Status of CnodeAPIDataSystems 'type=autocomplete' requests","group":"Parsing","status":"operational"},{"component":"Author Page Requests","description":"Status of CnodeAPIDataSystems 'type=author_page' requests","group":"Parsing","status":"operational"}]}}
And here is my code using the JSON parser: (Tim Halls Code: https://github.com/VBA-tools/VBA-JSON)
Code:
Dim ret As Dictionary
Dim val As Variant
Set ret = ParseJson(resp)
For Each val In ret("account_info")
Debug.Print val
Next
This gives...
Code:
api_key
name
email
plan
credits_used
credits_remaining
credits_reset_at
credits_limit
zipcodes_used
zipcodes_limit
zipcodes_available
account_balance_usd
account_balance_message
destinations_used
destinations_limit
destinations_available
overage_allowed
overage_enabled
overage_limit
overage_used
collections_used
collections_limit
collections_available
usage_history
status
I need to be able to grab the values of these properties! How do I do this.
Thanks