json syntax issues

Shockey

[H]ard|Gawd
Joined
Nov 24, 2008
Messages
2,031
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.

2019-07-12T18:23:48.285439+00:00 vxrmxxxxxxx tomcat-instance-ctl.sh[2885]: 2019-07-12T18:23:48.283+0000 ERROR [tomcat-http--19] com.emc.mystic.manager.web.webutil.RestErrorHandler RestErrorHandler.handleExceptionInternal:210 - Handling exception for request ServletWebRequest: uri=/extension/mystic/v1/lcm/upgrade;client=xxxxxxxxxx;session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;user=administrator@vsphere.local
2019-07-12T18:23:48.285841+00:00 vxrm02pi02lv tomcat-instance-ctl.sh[2885]: org.json.JSONException: Unterminated string at 87 [character 0 line 3]
2019-07-12T18:23:48.286101+00:00 vxrm02pi02lv tomcat-instance-ctl.sh[2885]: #011at org.json.JSONTokener.syntaxError(JSONTokener.java:433) ~[json-20151123.jar:?]
2019-07-12T18:23:48.286358+00:00 vxrm02pi02lv tomcat-instance-ctl.sh[2885]: #011at org.json.JSONTokener.nextString(JSONTokener.java:261) ~[json-20151123.jar:?]
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"
 }
 }
 }
}
 

Attachments

Last edited:

modi123

Supreme [H]ardness
Joined
Sep 6, 2006
Messages
5,768
Why are you using two types of quotes?

These: “ ” need to all be "
 

Shockey

[H]ard|Gawd
Joined
Nov 24, 2008
Messages
2,031
Why are you using two types of quotes?

These: “ ” need to all be "[/QUO
Why are you using two types of quotes?

These: “ ” need to all be "
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"
 }
 }
 }
}
 
Top