Add item to VBA dictionary with quotes

kozelibe

New Member
Joined
Jan 31, 2007
Messages
23
Hello,

I'm trying to add the key classificationLevels with a value of ["Sectors"] (yes, I need the quotes) to a dictionary

When I try

Body.Add "classificationLevels", "[""Sectors""]"

I actually add the following with the extra ""s.

["Sectors"]

I also tried

Body.Add "classifiactionLevels", "[" & chr(34) & "Sectors" & chr(34) & "]"

I still get the unwanted ""s.

This is part of a JSON web request. I can put the entire JSON web request string value in a cell and it will work. However, I will be changing the JSON string many times and my code would be much cleaner if I could create the JSON string as a dictionary.

How can I add ["Sectors"] without the extra ""s?

Thanks.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Interesting. The problem character disappeared when posting.

I'm not sure how to ask this if my post removed the problem.

The extra character is chr(47). Let me see if I can post the original using that.

Hello,

I'm trying to add the key classificationLevels with a value of ["Sectors"] (yes, I need the quotes) to a dictionary

When I try

Body.Add "classificationLevels", "[""Sectors""]"

I actually add the following with the extra chr(47)s.

[chr(47)"Sectorchr(47)"]

I also tried

Body.Add "classifiactionLevels", "[" & chr(34) & "Sectors" & chr(34) & "]"

I still get the unwanted chr(47)s.

This is part of a JSON web request. I can put the entire JSON web request string value in a cell and it will work. However, I will be changing the JSON string many times and my code would be much cleaner if I could create the JSON string as a dictionary.

How can I add ["Sectors"] without the extra chr(47)s?

Thanks.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top