You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are trying to fetch the value from jsonata and return the result to another method. below is the sample code which we are trying but it always returning promise with pending. so is there any possible to call jsonata with sync method or return value from jsonata
Ex: Code :
const jsonata = require('jsonata');
async function CallJsonAta()
{
const body = {
"data" : {
"title" : "title1",
"description": "description1",
"blog": "This is a blog.",
"date": "11/4/2013"
},
"map" : "sample"
};
let out = JSON.parse(JSON.stringify(body));
let result = await jsonata('data.title').evaluate(out);
return result;
}
console.log("Result : ", CallJsonAta());
Actual Output:
Result : Promise { < pending > }
Expected Output:
Result : title1
The text was updated successfully, but these errors were encountered:
SyntaxError: missing ) after argument list
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1166:20)
at Module._compile (node:internal/modules/cjs/loader:1210:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1300:10)
at Module.load (node:internal/modules/cjs/loader:1103:32)
at Module._load (node:internal/modules/cjs/loader:942:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at node:internal/main/run_main_module:23:47
Hi,
We are trying to fetch the value from jsonata and return the result to another method. below is the sample code which we are trying but it always returning promise with pending. so is there any possible to call jsonata with sync method or return value from jsonata
Ex: Code :
const jsonata = require('jsonata');
async function CallJsonAta()
{
const body = {
"data" : {
"title" : "title1",
"description": "description1",
"blog": "This is a blog.",
"date": "11/4/2013"
},
"map" : "sample"
};
let out = JSON.parse(JSON.stringify(body));
let result = await jsonata('data.title').evaluate(out);
return result;
}
console.log("Result : ", CallJsonAta());
Actual Output:
Result : Promise { < pending > }
Expected Output:
Result : title1
The text was updated successfully, but these errors were encountered: