Forum: Ruby How to generate JSON at runtime with nested structure?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
0d29cf4e6f6ef97aad3c5eadb6e83283?d=identicon&s=25 Seema K. (seemak)
on 2014-04-01 16:15
Attachment: input.json (761 Bytes)
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 topic is locked and can not be replied to.