I want to convert JSON to YAML. And I want to this in Java dynamically. Based on the componentId, properties will change. This JSON can vary and supports multiple componentIds and this comes from HTTP request.
Example JSON:
[
{
"id": "timer",
"attributes": {
"type": "tick"
"period": "5000"
},
"output": "transform"
},
{
"id": "transform",
"attributes": {
"expression": "${body.toUpperCase()}”,
“type”: “simple"
},
"output": "log"
},
{
"id": "log",
"attributes": {
"message": "hello world”,
“type”: “info"
}
}
]
Expected YAML:
- from:
uri: "timer:tick"
parameters:
period: "5000"
steps:
- set-body:
constant: "Hello Yaml!!!"
- transform:
simple: "${body.toUpperCase()}"
- to: "log:info”