VBA-tools / VBA-JSON

JSON conversion and parsing for VBA
MIT License
1.74k stars 566 forks source link

Please help !!! problems with multiple JSON-VBA in MS Access 2019/365 #227

Closed rwiedemannn closed 2 years ago

rwiedemannn commented 2 years ago

Hi,

I use MS ACCESS and simple responses work perfectly.

the VBA-JSON is a great tool, but actually i have a problem to parse items from following json response, if the JSON response is multi-level:

{"orderStatus":{"tourGuid":"fc8578f9-2c29-41d2-bbea-363070d33949","orderGuid":"7da1170f-36eb-4fd2-b3c8-4f1666bec0db","orderState":0,"tourArrival":"11:49","eta":null,"formdata":null,"guid":"02928fe7-a8ef-4cac-a7d8-6d5004fb8fa8"},"status":{"code":100,"description":null,"invalidItemKeys":null}}

Does anyone have a solution or suggestion for me? I need the items "orderState" and "tourArrival".....

Many many thanks to the community here ! Best from Rene

aholden10 commented 2 years ago

If you tell the group what you've already tried you will probably get a quicker and better reply! In the meantime I believe this is the map of your JSON: ('orderStatus')('tourGuid') => 'fc8578f9-2c29-41d2-bbea-363070d33949'('orderStatus')('orderGuid') => '7da1170f-36eb-4fd2-b3c8-4f1666bec0db'('orderStatus')('orderState') => 0('orderStatus')('tourArrival') => '11:49'('orderStatus')('eta') => None('orderStatus')('formdata') => None('orderStatus')('guid') => '02928fe7-a8ef-4cac-a7d8-6d5004fb8fa8'('status')('code') => 100('status')('description') => None('status')('invalidItemKeys') => None

On Tuesday, May 3, 2022, 07:59:31 AM EDT, rwiedemannn ***@***.***> wrote:  

Hi,

I use MS ACCESS and simple responses work perfectly.

the VBA-JSON is a great tool, but actually i have a problem to parse items from following json response, if the JSON response is multi-level:

{"orderStatus":{"tourGuid":"fc8578f9-2c29-41d2-bbea-363070d33949","orderGuid":"7da1170f-36eb-4fd2-b3c8-4f1666bec0db","orderState":0,"tourArrival":"11:49","eta":null,"formdata":null,"guid":"02928fe7-a8ef-4cac-a7d8-6d5004fb8fa8"},"status":{"code":100,"description":null,"invalidItemKeys":null}}

Does anyone have a solution or suggestion for me? I need the items "orderState" and "tourArrival".....

Many many thanks to the community here ! Best from Rene

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

rwiedemannn commented 2 years ago

Many thanks for the answer. I managed to do it myself today with this code and it works perfectly! Big thanks again!

_Dim JsonORDERstatus As Dictionary Set JsonORDERstatus = JsonConverter.ParseJson(requestStringORDER.ResponseText)

Me!Text13 = requestStringORDER.ResponseText Me!FO_ARCH_ENDK_DDF_arrival = JsonORDERstatus("orderStatus")("tourArrival") Me!FO_ARCH_ENDK_DDF_orderstatus = JsonORDERstatus("orderStatus")("orderState") Me!FO_ARCH_ENDK_DDFeta = JsonORDERstatus("orderStatus")("eta") DoCmd.Save

aholden10 commented 2 years ago

Excellent, glad you got to the answer yourself!

On Wednesday, May 4, 2022, 10:34:16 AM EDT, rwiedemannn ***@***.***> wrote:  

Many thanks for the answer. I managed to do it myself today with this code and it works perfectly! Big thanks again!

_Dim JsonORDERstatus As Dictionary Set JsonORDERstatus = JsonConverter.ParseJson(requestStringORDER.ResponseText)

Me!Text13 = requestStringORDER.ResponseText Me!FO_ARCH_ENDK_DDF_arrival = JsonORDERstatus("orderStatus")("tourArrival") Me!FO_ARCH_ENDK_DDF_orderstatus = JsonORDERstatus("orderStatus")("orderState") Me!FO_ARCH_ENDK_DDFeta = JsonORDERstatus("orderStatus")("eta") DoCmd.Save

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>