Deserialize JSON/Deserialize JSON Array

Error: Deserialize JSON: Deserialized JSON type ‘Newtonsoft.Json.Linq.JArray’ is not compatible with expected type ‘Newtonsoft.Json.Linq.JObject’. Path ‘’, line 1, position 713.

It keeps showing this error despite using either Deserialize JSON/Deserialize JSON Array and the output as Newtonsoft.Json.Linq.JObject. How can I fix this?

Ultimately, I’m trying to take information extracted from a screenplay activity on a website and upload it into a data table, then written into a google sheet.

@conai_smith

Welcome to the community

first check the string that you are getting..is a valid json or jarray

print the extracted string to check

cheers

Can you share screenshot of error and also check in immediate window for the JSON , how you are getting it.

Hi @conai_smith

This error means your API response is actually a JSON Array ([…]), but your Deserialize activity is expecting a JSON Object ({…}).
So check the first character and try to print in logs and see what value comes

Cheers

Hello,

Thanks!

The log message (Output result from the screenplay) is as follows:
{
“message”: “[{"title": "VIVAGO Bamboo Toothbrushes 10 Pack - BPA Free Soft Bristl…", "rating": "4.5 out of 5 stars", "price": "$9.98"}, {"title": "VIVAGO Bamboo Toothbrushes Medium Bristles 10 Pack - BP…", "rating": "4.5 out of 5 stars", "price": "$9.98"}, {"title": "VIVAGO Kids Bamboo Toothbrushes 6 Pack - BPA Fr…", "rating": "4.6 out of 5 stars", "price": "$9.98"}, {"title": "VIVAGO Bamboo Toothbrushes 10 Pack - BPA Free Soft Bristles Toothbrushes, Eco-Friendly, Natural Wooden Toothbrush", "rating": "4.5 out of 5 stars", "price": "$9.98"}, {"title": "Biodegradable Eco-Friendly Natural Bamboo Charcoal Toothbrushes, FSC Certified and PETA Approved - 12 Count", "rating": "4.5 out of 5 stars", "price": "$9.49"}]”,
“level”: “Information”,
“logType”: “User”,
“timeStamp”: “09:16:21”,
“fileName”: “Main”,
“jobId”: “5d0c1800-8632-43bf-ac57-6094028340e5”,
“robotName”: “cxsmith7@gmail.com-attended”,
“machineId”: 4785045,
“userKey”: “7e8b1999-0519-46b6-8a06-c57ee612b575”,
“processVersion”: “1.0.0”,
“organizationUnitId”: 6437520,
“businessOperationId”: “1b17599a86134a2eb55a365b39529391-0895a82042e6414a9388cd0678dcd453”
}