json syntax issues

Discussion in 'Webmastering & Programming' started by Shockey, Jul 12, 2019.

  1. Shockey

    Shockey [H]ard|Gawd

    Messages:
    1,990
    Joined:
    Nov 24, 2008
    Hello All,

    Looking to see if someone who has more experience with JSON format can take a look at the below and see if they see why i keep getting syntax errors. Everytime i fix one error another pops up. I'm following example from attached document on page 74. Also using Postman as my API tool.

    Below is error message for the API i'm working with.

    The JSON body.

    Code:
    {
     "bundle_file_locator":"/tmp/VXRAIL_COMPOSITE-4.7.211-13893930_for_4.7.x.zip",
     "vxrail":{
     "vxm_root_user":"{
     "username":"root",
     "password":"xxxxxxxxxxxxxxx!"
     }
     },
     "vcenter":{
     "vc_admin_user":"{
     "username":"administrator@vsphere.local",
     "password":"xxxxxxxxxxxxxxxxxxxx"
     },
     "vcsa_root_user":"{
     "username":"root",
     "password":"xxxxxxxxxxxxxxxxxxxxxxxxxx"
     },
     "psc_root_user":"{
     "username":" root",
    "password":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
     },
     "migration_spec":{
     "source_vcsa_host":{
     "name":"vxr02pi05.corp.nm.org",
     "user":{
     "username":"root",
     "password":"xxxxxxxxxxxxxxxxxxx"
     }
     },
     "source_psc_host":{
     "name":"vxr02pi06.corp.nm.org",
     "user":{
     "username":"root",
     "password":"xxxx"
     }
     },
     "target_vcsa_host":{
     "name":"vxr02pi07.corp.nm.org",
     "user":{
     "username":"root",
     "password":"xxxxxxxxxxxxxx"
     }
     },
     "temporary_ip_setting":{
     "temporary_ip":"172.21.210.240",
     "gateway":"172.21.210.254",
     "netmask":"255.255.255.0"
     }
     }
     }
    }
    
     

    Attached Files:

    Last edited: Jul 12, 2019
  2. modi123

    modi123 [H]ardness Supreme

    Messages:
    5,359
    Joined:
    Sep 6, 2006
    Why are you using two types of quotes?

    These: “ ” need to all be "
     
  3. Shockey

    Shockey [H]ard|Gawd

    Messages:
    1,990
    Joined:
    Nov 24, 2008
    Corrected those and noticed that there is extra " in the formatting. Removed that and it works.

    Thanks for help!

    Json body that works is below

    Code:
    {
     "bundle_file_locator":"/tmp/VXRAIL_COMPOSITE-4.7.211-13893930_for_4.7.x.zip",
     "vxrail":{
     "vxm_root_user":{
     "username":"root",
     "password":"xxxxxxxxxxxxxxxxxxxxxxx"
     }
     },
     "vcenter":{
     "vc_admin_user":{
     "username":"administrator@vsphere.local",
     "password":"xxxxxxxxxxxxxxx"
     },
     "vcsa_root_user":{
     "username":"root",
     "password":"xxxxxxxxxxxxxxxxxxx"
     },
     "psc_root_user":{
     "username":"root",
    "password":"xxxxxxxxxxxxxxxxx"
     },
     "migration_spec":{
     "source_vcsa_host":{
     "name":"xxxxxxxxxxxxxxxxxxxxxxxxx",
     "user":{
     "username":"root",
     "password":"xxxxxxxxxxxxxxxxxxxxxxxx"
     }
     },
     "source_psc_host":{
     "name":"xxxxxxxxxxxxxxxxxxxxxxxx",
     "user":{
     "username":"root",
     "password":"xxxxxxxxxxxxxxxxx"
     }
     },
     "target_vcsa_host":{
     "name":"xxxxxxxxxxxxxxxxxxxxxx",
     "user":{
     "username":"root",
     "password":"xxxxxxxxxxxxxxxxxxxxxxxxx"
     }
     },
     "temporary_ip_setting":{
     "temporary_ip":"xxxxxxxxxxxxxxxxxx",
     "gateway":"xxxxxxxxxxxxxxxxxxx",
     "netmask":"255.255.255.0"
     }
     }
     }
    }