IntelliJ and other IDEs provide plugins for the same.
For eg- https://plugins.jetbrains.com/plugin/13804-convert-yaml-and-properties-file
Install the plugin, right click on your yaml or properties file and choose - "Convert yaml and properties file".
Answer from Satakshi Pandey on Stack OverflowVideos
Is the YAML converter free to use?
Can I convert large YAML files?
Does the converter preserve data types?
IntelliJ and other IDEs provide plugins for the same.
For eg- https://plugins.jetbrains.com/plugin/13804-convert-yaml-and-properties-file
Install the plugin, right click on your yaml or properties file and choose - "Convert yaml and properties file".
With Spring Boot 2.4, there's the possibility to use the switch spring.config.activate.on-profile for this purpose, everything defined after spring.config.activate.on-profile=myprofile will only be set when the active profile is set to myprofile. In the given example, you would do as follows:
#-- Peer1 Config
spring.config.activate.on-profile=peer1
eureka.instance.hostname=peer1
eureka.client.serviceUrl.defaultZone=http://peer2/eureka/
#-- Peer2 Config
spring.config.activate.on-profile=peer2
eureka.instance.hostname=peer2
eureka.client.serviceUrl.defaultZone=http://peer1/eureka/
See https://spring.io/blog/2020/08/14/config-file-processing-in-spring-boot-2-4 for more information.
I dealt with the same problem using a python script.
Just clone and run:
$ python yaml2props.py {your_path_file}
Note
In my specific case on Ubuntu 18.04, I had to install pyperclip library and use python3, so:
$ pip3 install pyperclip
$ python3 yaml2props.py {your_path_file}
The yml is a tree, to convert to a properties you just need the extra boilerplate of the preceding hierarchy e.g.
pay.payment.sandbox.url=https://securegw-stage//processTransaction
pay.payment.sandbox.callbackurl=http://localhost:8080/pgresponse
pay.payment.sandbox.details.CHANNEL_ID='${pay.payment.sandbox.channelid}'
pay.payment.sandbox.details.INDUTRY_TYPE_ID='${pay.payment.sandbox.industrytypeid}'
pay.payment.sandbox.details.CALLBACK_URL='${pay.payment.sandbox.callbackUrl}'