function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Priyesh Misquith 12Priyesh Misquith 12 

passing JSON from QCP javascript to Apex class for callout

I have JSON in below format and passing to the apex class from QCP through JavaScript. I am getting following error JSON_PARSER_ERROR : JSON request body must be an object at [Line 1, column2]. I am not able to figure out what is going wrong here.
 
const PATH = "/services/apexrest/pricing/";
export function onAfterCalculate(quote, lines, conn) {
 var body='{
     "billingCountry":"United States",
     "accountType":"Executive Account",
     "salesPrice":100,
     "quotelines":[
                   {
                   "quoteNumber":"01233365564idf",
                   "lineType":"Initial",
                   "quantity":400,
                   "producttype":"support"
                   },
                   {
                   "quoteNumber":"1234365564idf",
                   "lineType":"Final",
                   "quantity":1500,
                   "producttype":"Hardware"
                    }
                   ]
      }'

      const baseUrl = conn.instanceUrl + PATH;
      const url = baseUrl.replace("--sbqq.visualforce", ".my.salesforce");
    
      console.log(`URL: ${url}`);
      console.log("Request Body: ");
      console.log(body);
    
      return conn
        .requestPost(url, body)
        .then(res => {
          // Parse the response
          const priceResponse = JSON.parse(res);
        })
        .catch(err => {
          // catch any errors
          console.log("External Pricing Error", err);
        });  
    
    }

I have the apex controller
 
@RestResource(urlMapping='/pricing/*')
global class calloutClass{

   global class jsonFields{
   global string billingCountry;
   global string accountType;
   global Decimal salesPrice;
   global list<lineClass> quotelines;
}
global class lineClass{

 global string quoteNumber;
 global string lineType;
 global integer quantity;
 global string producttype;
 }

@Httppost
global static string sendQuotedetails(List<jsonFields> quotebody){
 // callout done from here
}
    }

also tried with
@Httppost
global static string sendQuotedetails(String quotebody){
 // callout done from here
}
    }

Nothing has resolved the issue.