Here is a text file in console output on nodejs/express backend server and it carries neat format:
abi: [
{
"inputs": [
{
"internalType": "uint256",
"name": "_value",
"type": "uint256"
},
{
"internalType": "string",
"name": "_itemName",
"type": "string"
},
...
]
When the file above is received in mobile front end (React Native), it becomes:
abi: '[
{
"inputs": [
{
"internalType": "uint256",
"name": "_value",
"type": "uint256"
},
{
"internalType": "string",
"name": "_itemName",
"type":...]'
The format and content of the text file has been changed by addition of
and
and it can't be used as input for a function call. Is there way the original nice and neat format can be preserved or restored when returned from a nodejs server?
UPDATE:
The text string is returned on nodejs/express server as json format:
return res.status(200).send({dude:_dude.deploy_address, fex:_fex.deploy_address, forsale:{abi:_forsale.abi, bytecode:_forsale.bytecode}});
Here is the fetch
from the mobile:
let res = await fetch(beUrl, {method: "GET", headers: {
'Accept': 'application/json, text/plain',
'Content-Type': 'application/json',
}});
let res1 = await res.json();
question from:
https://stackoverflow.com/questions/65840853/how-to-preserve-text-format-when-return-in-nodejs-express 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…