When attempting to use the API Explorer for Cluster Creation (validation) POST in VMware Cloud Foundation (VCF) 5.2, the task fails during the validation phase. The following error is returned in the API response or observed in domainmanager.log.
{ "message": "Unexpected token ] in JSON at position 8182", "status": 400}
The .json file contains incorrect JSON syntax, such as missing quotation marks around keys and values or missing directory slashes.
Specific examples include:
Missing Closing Quote: In the first host entry (hostSpecs[0]), a missing closing double-quote for the licenseKey causes the parser to treat subsequent text as part of the string until it encounters another quote, leading to a failure later in the file.
Unclosed datastoreSpec Block: Missing closing braces for nested configurations (e.g., vsanMaxConfig, esaConfig, vsanDatastoreSpec).
Take a snapshot of the SDDC Manager VM before proceeding with any manual file modifications.
1. Connect to SDDC Manager: Connect to the SDDC Manager appliance using SSH and switch to the root user.
2. Create a Backup: Create a backup of the existing specification file:
cp spec.json spec.json.bak3. Validate JSON Syntax: Use jq to identify the exact location of the syntax error:
jq empty spec.json
4. Edit the Specification File: Open spec.json in a text editor (vi spec.json) and apply the following corrections:
Example 1: Missing Closing Quote
Incorrect configuration spec:"hostSpecs": [ { "id": "######-#####-#####-####-#######", "licenseKey": "################, "username": "root"}]
Correct configuration spec would be as below:"hostSpecs": [ { "id": "######-#####-#####-####-#######", "licenseKey": "################", "username": "root"}]
Example 2: Missing Closing Brace
Incorrect configuration spec:"datastoreSpec": { "vsanDatastoreSpec": { "esaConfig": { "vsanMaxConfig": { "enableVsanMax": false } }}
Correct configuration spec would be as below:"datastoreSpec": { "vsanDatastoreSpec": { "esaConfig": { "vsanMaxConfig": { "enableVsanMax": false } } }}
(Note: Ensure 4 closing braces are present to close vsanMaxConfig, esaConfig, vsanDatastoreSpec, and datastoreSpec.)
5. Retry Validation: Once corrected and verified by jq, retry the POST request in API Explorer.