Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-41347

Using JSON-Editor Returns Unformatted Json String

XMLWordPrintable

      When attempting to use the Extended Choice plugin to export a json config to a file, it returns a string with no double quotes in it, rendering the json invalid.

      Build Log:
      Machine_Settings="{"containers":[{"hostname":"EDMCT","machine_template":"local:vztmpl/debian-jessie-custom.tar.gz","memory":512,"net":[

      {"br":"vmbr1","dev":"eth0","gw":"192.168.15.1","ip":"dhcp","name":"net0","type":"veth","vlan":15}

      ],"node":"EDMHS0101","root_password":"asdasd","storage":"development-machines","storage_size":2,"swap":512}],"variable_host":"192.168.0.101"}"

      1. Create a new container (on the ssh host)
        cd ~/playbooks
        export JSON=${Machine_Settings}
        echo $JSON > /tmp/create-lxc-instance.json

      the /tmp/create-lxc-instance.json file:
      {containers:[{hostname:EDMCT,machine_template:local:vztmpl/debian-jessie-custom.tar.gz,memory:512,net:[

      {br:vmbr1,dev:eth0,gw:192.168.15.1,ip:dhcp,name:net0,type:veth,vlan:15}

      ],node:EDMHS0101,root_password:asdasd,storage:development-machines,storage_size:2,swap:512}],variable_host:192.168.0.101}

      (The formatted data, but with no quotes so it is invalid json).

      Perhaps I'm just going about this wrong, but I cannot seem to get a formatted json string that is usable no matter what I try. The exported data does still have the quotes, but as soon as I try to use it in the shell the quotes are gone.

            vimil vimil
            tchristie Taylor Christie
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: