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
{{ message }}
This repository has been archived by the owner on May 30, 2023. It is now read-only.
i'm working with casperJS but i think the issue comes from phantomjs, that's why i post here. It seems that null values in json results are not properly handled by the evaluate method : with the following sample test:
var casper = require('casper').create();
casper.start("http://www.google.com/");
var res = (
casper.evaluate(
function() { return {foo: null}; }
)
);
console.log(JSON.stringify(res));
the output is {foo: ""} instead of {foo:null}. I have to use the following workaround to get the correct output:
var casper = require('casper').create();
casper.start("http://www.google.com/");
var res = (
casper.evaluate(
function() { return "res:" + JSON.stringify({foo: null}); }
)
);
console.log(JSON.stringify(JSON.parse(res.substring(4))));
it seems that evaluate does an implicit stringify on the client side followed by an implicit parse on the server side, but those calls mess up null values. I read the documentation about evaluate but didn't found any hint about why such behaviour or means to override it
while the workaround is doing what i need, it seems like a performance waste and it would be better to directly have null values in my first test case. Can someone provide some informations on this issue ?
thanks a lot
The text was updated successfully, but these errors were encountered:
Due to our very limited maintenance capacity (see #14541 for more details), we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed. In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!
hi,
i'm working with casperJS but i think the issue comes from phantomjs, that's why i post here. It seems that null values in json results are not properly handled by the evaluate method : with the following sample test:
var casper = require('casper').create();
casper.start("http://www.google.com/");
var res = (
casper.evaluate(
function() { return {foo: null}; }
)
);
console.log(JSON.stringify(res));
the output is {foo: ""} instead of {foo:null}. I have to use the following workaround to get the correct output:
var casper = require('casper').create();
casper.start("http://www.google.com/");
var res = (
casper.evaluate(
function() { return "res:" + JSON.stringify({foo: null}); }
)
);
console.log(JSON.stringify(JSON.parse(res.substring(4))));
it seems that evaluate does an implicit stringify on the client side followed by an implicit parse on the server side, but those calls mess up null values. I read the documentation about evaluate but didn't found any hint about why such behaviour or means to override it
while the workaround is doing what i need, it seems like a performance waste and it would be better to directly have null values in my first test case. Can someone provide some informations on this issue ?
thanks a lot
The text was updated successfully, but these errors were encountered: