cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jiwhite
Advocate I
Advocate I

string() removes spaces from JSON values

When I use string(object) to turn a JSON object into a string, it does not preserve all of the spaces inside string JSON values.  Double spaces are reduced to single spaces. For example, "ANION:  Chloride" becomes "ANION: Chloride" Is there any way to stop this from happening other than replacing double spaces with another character, then change them back at the final point of use? This is a serious bug.

2 REPLIES 2
Rhiassuring
Super User
Super User

Hi there, 

 

I'd like to know more specifics of the steps you've taken where you're running into this scenario. I just tried string() and I also tried placing JSON with double spacing into a string variable (just so see), with the double spacing retained in both. 

 

Thanks,

 

Rhia

I create an object with a 2D array populated from an Excel file that has strings in the values. Some of our test parameters were named including double spaces years ago.

 

jiwhite_2-1658505260769.png

 

 

jiwhite_3-1658505387733.png

jiwhite_0-1658504934945.png

Then, pass it to a To-Do

jiwhite_1-1658505004904.png

This is how I get the test cells and convert the sensitive label in Office Script.

jiwhite_4-1658505719754.png

I also tried putting it in a string variable.  Whether I pass the object directly or use string(object), the same thing happens. The double spaces in test names get replaced with single spaces. To get around it, I replace "  " with "**" when creating the 2D array, then replace "**" with "  " when using the 2D array to populate another Excel File.

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events happening this month - don't miss out!

 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (4,058)