I got an Object Text from the background here, and now I need to convert it to String for output. Could you please tell me how I can convert it? I tried many methods on the Internet but it didn't work. . .
It looks like this when the content alert pops up
Let it output on the console like this
I want to turn it into a string because there are subsequent operations. Is there any way?
You can get the object content through console.dir(a);, so you can see that there is a data attribute, and you can get the string by getting the .data attribute.
JSON.stringify() Try if it works
stringify() is used to parse a string from an object, such as
var
a = {a:1,b:2}
Result:
JSON.stringify(a)
"{"a":1,"b":2}"
Try
Result of.data
or.wholeText
alert(a):
The result of
alert(a.data):
Result of
alert(a.wholeText):
How is the data? Post a picture. I don’t know what’s going on!