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

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
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,224,827
Messages
6,181,194
Members
453,021
Latest member
pingpong7117

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