How to generate JSON at runtime with nested structure?

Hi,
How can I create json file at runtime in Ruby with nested structure.

My JSON Format is

{
“id”: “0”,
“lockVersion”: 0,
“name”: “seema”,
“description”: “Rest-Cloud-SeemaKhalkar_100”,
“cloudProviderTypeRef”: {
“id”: “1”
},
“host”: “”,
“proxyUrl”: “”,
“credential”: {
“userName”: “leander1”,
“passKey”: “vmware”,
“encrypted”: false,
“type”: “PASSWORD”
},
“properties”: [
{
“propertyDefinition”: {
“id”: “1023”,
“lockVersion”: 0,
“name”: “PLAB-ORG”,
“description”: “PLAb-ORG Organization”,
“key”: “organization”,
“type”: “STRING”,
“secure”: false,
“required”: false
},
“value”: “PLAB-ORG”,
“overrideable”: false
}
]
}
I wan’t to generate it at runtime with dynamic keys as well as values.
what is the best solution for it?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs