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

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
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,213,561
Messages
6,114,316
Members
448,564
Latest member
ED38

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