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
I try to print out large responses from an API pretty to the console. When using console.log(prettyjson.render(body)) I will get the normal output. When I save the response to a file and invoke the CLI version onto it, it works very fine (great job, still big thanks to you!).
I have decided to only save a smaller part of it and try it out, just to make sure it is not because of the size of the string. I have also linted it, but the JSON is valid. The excerpt is
When using the following code, I get the error message displayed underneath
var prettyjson = require('prettyjson'),
fs = require('fs');
var data = fs.readFile('todoistResponse');
var options = {
noColors: true,
};
console.log(prettyjson.render(data, options));
Nicks-Air:node-todoist-api nicklehmann$ node pretty.js
/Users/nicklehmann/Desktop/node-todoist-api/node_modules/prettyjson/lib/utils.js:16
Object.getOwnPropertyNames(input).forEach(function(key) {
^
TypeError: Cannot convert undefined or null to object
at Function.getOwnPropertyNames (native)
at Object.exports.getMaxIndexLength (/Users/nicklehmann/Desktop/node-todoist-api/node_modules/prettyjson/lib/utils.js:16:10)
at renderToArray (/Users/nicklehmann/Desktop/node-todoist-api/node_modules/prettyjson/lib/prettyjson.js:141:52)
at Object.render (/Users/nicklehmann/Desktop/node-todoist-api/node_modules/prettyjson/lib/prettyjson.js:210:10)
at Object.<anonymous> (/Users/nicklehmann/Desktop/node-todoist-api/pretty.js:16:24)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:475:10)
I would be delighted to hear any advise!
The text was updated successfully, but these errors were encountered:
I try to print out large responses from an API pretty to the console. When using
console.log(prettyjson.render(body))
I will get the normal output. When I save the response to a file and invoke the CLI version onto it, it works very fine (great job, still big thanks to you!).I have decided to only save a smaller part of it and try it out, just to make sure it is not because of the size of the string. I have also linted it, but the JSON is valid. The excerpt is
When using the following code, I get the error message displayed underneath
I would be delighted to hear any advise!
The text was updated successfully, but these errors were encountered: