Text Analysis

फ़्री
द्वारा Bhavya Gaur | अपडेट किया गया 4日前 | Text Analysis
लोकप्रियता

9.8 / 10

लेटेंसी

393ms

सेवा का स्तर

100%

Health Check

N/A

सभी चर्चाओं पर वापस जाएं

validation error, incorrect data passed to the server for JS code

Rapid account: Srinichrocks
srinichrocks
2年前

Hi, I tried using JSON.stringify to convert the Javascript object which currently looks like this(message is a state variable I have):

{
“language”:“english”,
“summary_percent”:10,
“text”:{message}
}

But for some reason, it does not work. Does anyone have suggestions as to what I could use in order to convert the javascript object into a json string as I keep getting the error “validation error, incorrect data passed to the server”

Rapid account: Readervm
readervm Commented 2年前

See if the below JS code helps…

const data = {
“language”: “english”,
“text”: “Falcon 9’s first stage has landed on the Of Course I Still Love You droneship – the 9th landing of this booster”
};
const options = {
method: ‘POST’,
headers: {
‘content-type’: ‘application/json’,
‘X-RapidAPI-Key’: ‘Your API Key’,
‘X-RapidAPI-Host’: ‘text-analysis12.p.rapidapi.com
},
body: JSON.stringify(data)
};

fetch(‘https://text-analysis12.p.rapidapi.com/sentiment-analysis/api/v1.1’, options)
.then(response => response.json())

Rapid account: Gaurmanojkumar 530
gaurmanojkumar530 Commented 2年前

The default RapidAPI code generator for JS using Axios library works. Please refer it.

चर्चा में शामिल हों - नीचे टिप्पणी जोड़ें:

नई टिप्पणियाँ पोस्ट करने के लिए लॉग इन / साइनअप करें