VBA-tools / VBA-Web

VBA-Web: Connect VBA, Excel, Access, and Office for Windows and Mac to web services and the web
http://vba-tools.github.io/VBA-Web/
MIT License
2.01k stars 494 forks source link

AllowUnquotedKeys #334

Open certifirm opened 6 years ago

certifirm commented 6 years ago

I want to parse this json to object

{code:200,request_id:idc1date20180425112737,request:send,status:Success,sent:{sent_id:1276978,total_recipients:1}}

I try this VBA code but it fails:

 WebHelpers.JsonOptions.AllowUnquotedKeys = True
 Dim Json As Object
Set Json = ParseJson("{code:200,request_id:idc1date20180425112737,request:send,status:Success,sent:{sent_id:1276978,total_recipients:1}}")

What am I doing wrong?

timhall commented 6 years ago

I'm not sure what exactly the error is, but note that AllowUnquotedKeys only works for keys, not values. So the values idc1..., send, and Success are potentially throwing errors since they are unquoted. If you could post more of the error you are getting I can look at it.