- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Editing Json Files with Text Replacements...
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Editing Json Files with Text Replacements...
Hi there,
We have a bunch of configurations we write to a configuration file which has been switched to JSON. I'm using text replacements and some of the values are edited correctly, but there is a slight problem with some others.
For some values, we edit using a property. At times that property will be = "", if not previously configured in an earlier version. The particular value needs something written to it so we have a second replacement to restore the default value... something like this...
"VLBasePath": "",
That value was not previously configured so we add a second replace to replace VLBasePath": "" with VLBasePath": "C:\\Some\\Folder\\Path", for example.
That worked fine with our previous config file but with JSON, the first edit is written with two spaces in between the : and "". What's even stranger, when I copy one of the actual key/value pairs from the file and past elsewhere, there is only one space pasted. For the above example, in the actual file it appears as "VLBasePath": "". I copied that and pasted above and there was only one space pasted.
I'm just wondering if text replacement is the best way to go about editing the newly utilized JSON file. Will edits via Text Replacement always put that extra space between : and "value"? If so, I can change my other replacements to simply replace with two spaces in that location.
We have a ton of values that get edited so I hope I don't have to write an action and pass in a ton of parameters.
Any guidance with JSON editing via InstallShield would be greatly appreiated!
Thanks in advance!!
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
I went ahead and bypassed the Test Replacements method and coded a Custom Action to do the Json editing.