Slackbot
06/08/2023, 10:46 PMAdam
06/09/2023, 4:30 AMgetExtensions().getExtensionSchema()
to get all extensions, along with their names. And then you can convert that list of names to JSON, if you want.Matthew Moran
06/09/2023, 7:13 PMmyPluginDsl {
key1 = "some-string"
key2 {
nestedKey = "another-string"
}
}
How would I serialize this to json in my plugin? I’d like:
{
"key1": "some-string",
"key2": {
"nestedKey": "another-string"
}
}
Currently I have to something like this in my plugin to get that structure:
def data = [
'key1': "${extension.key1.get()}",
'key2': [
'nestedKey': "${extension.key2.nestedKey.get()}",
]
]
JsonOutput.toJson(data)
Is there a way to get extension dsl properties keys and values without manually setting the keys and values in the plugin?Adam
06/09/2023, 9:35 PMAdam
06/09/2023, 9:38 PMMatthew Moran
06/09/2023, 10:02 PMMatthew Moran
06/09/2023, 10:03 PMJsonOutput.toJson
should allow me to convert an groovy object to json. To build an object though, I need to know the keys beforehand, call .get
on each one while rebuilding the dsl structure in my plugin.