JSON doesn’t accept circular objects – objects which reference themselves. JSON.stringify()
will throw an error if it comes across one of these.
The request (req
) object is circular by nature – Node does that.
In this case, because you just need to log it to the console, you can use the console’s native stringifying and avoid using JSON:
console.log("Request data:"); console.log(req);
Related Posts:
- node.js TypeError: path must be absolute or specify root to res.sendFile [failed to parse JSON]
- TypeError: res.json is not a function
- Write / add data in JSON file using Node.js
- “SyntaxError: Unexpected token < in JSON at position 0"
- How can a Discord bot create a hyperlink in a Discord message in an embed or in general? [closed]
- SyntaxError: Unexpected token o in JSON at position 1
- Babel 6 regeneratorRuntime is not defined
- SyntaxError: Unexpected token o in JSON at position 1
- What is JSONP, and why was it created?
- Use a JSON array with objects with javascript
- Client on Node.js: Uncaught ReferenceError: require is not defined
- How can a Discord bot create a hyperlink in a Discord message in an embed or in general?
- Getting a UnhandledPromiseRejectionWarning when testing using mocha/chai
- Chrome sendrequest error: TypeError: Converting circular structure to JSON
- require is not defined? Node.js
- Client on Node.js: Uncaught ReferenceError: require is not defined
- Error: Can’t set headers after they are sent to the client
- TypeError: Router.use() requires middleware function but got a Object
- Express error – TypeError: Router.use() requires middleware function but got a Object
- Cannot GET / Nodejs Error
- Uncaught SyntaxError: Unexpected token u in JSON at position 0
- What is NODE_ENV and how to use it in Express?
- Node.js heap out of memory
- Reactjs – Form input validation
- await is only valid in async function
- How to set NODE_ENV to production/development in OS X
- await is only valid in async function
- How to read an external local JSON file in JavaScript?
- SyntaxError: Unexpected token o in JSON at position 1
- What does “res.render” do, and what does the html file look like?
- How to obtain username from Promise
? - NPM ELIFECYCLE error – using node server.js command
- Node.js – SyntaxError: Unexpected token import
- What is the “right” JSON date format?
- Uncaught TypeError: Cannot read property ‘length’ of undefined
- Node.js – SyntaxError: Unexpected token import
- What is the “right” JSON date format?
- stop all instances of node.js server
- Using Node.js require vs. ES6 import/export
- Failed to load resource: net::ERR_FILE_NOT_FOUND loading json.js
- ReferenceError : window is not defined at object.
Node.js - Node.js Port 3000 already in use but it actually isn’t?
- Unable to verify leaf signature
- npm – EPERM: operation not permitted on Windows
- SyntaxError: Unexpected token o in JSON at position 1
- AJAX response error: net::ERR_EMPTY_RESPONSE
- TypeError: Router.use() requires middleware function but got a Object
- TypeError: app.use() requires middleware functions
- Loading local JSON file
- Node.js document is not defined
- Node update a specific package
- How to convert selected HTML to Json?
- How to properly export an ES6 class in Node 4?
- Express error – TypeError: Router.use() requires middleware function but got a Object
- Failed to compile. Module not found: Can’t resolve ‘react-router-dom’
- MissingSchemaError: Schema hasn’t been registered for model “User”
- What is the difference between node.js and io.js?
- Convert Array to Object
- Npm install cannot find module ‘semver’
- How to download a file with Node.js (without using third-party libraries)?
- Make Axios send cookies in its requests automatically
- How do I remove documents using Node.js Mongoose?
- node-request – Getting error “SSL23_GET_SERVER_HELLO:unknown protocol”
- push object into array
- Why does JSHint throw a warning if I am using const?
- Difference between “module.exports” and “exports” in the CommonJs Module System
- Error: Cannot find module html
- JSON.parse() not working
- react router v^4.0.0 Uncaught TypeError: Cannot read property ‘location’ of undefined
- Refused to execute script, strict MIME type checking is enabled?
- TypeError: res.status is not a function
- Eslint: How to disable “unexpected console statement” in Node.js?
- How can I use webpack with express?
- SyntaxError: Unexpected token C in JSON at position 0 – Ionic 2 Http GET request
- SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
- Maximum call stack size exceeded on npm install
- JSON.parse unexpected token s
- How do you completely remove Ionic and Cordova installation from mac?
- How to filter JSON Data in JavaScript or jQuery?
- Error: listen EACCES 0.0.0.0:80 OSx Node.js
- How to sort in mongoose?
- What counts as CPU Intensive tasks (eg. sorting, searching etc?)
- How to convert binary string to decimal?
- events.js: 141 throw er; // Unhandled ‘error’ event
- Uncaught SyntaxError: Unexpected token with JSON.parse
- How to disable auto-start of “Node.js: Server-side JavaScript” when using Adobe Dreamweaver?
- How do I handle newlines in JSON?
- “NS_ERROR_DOM_BAD_URI: Access to restricted URI denied”
- “React.Children.only expected to receive a single React element child” error when putting
and in a - How to fix “TypeError: Right-hand side of ‘instanceof’ is not callable” when I use another module class?
- Uncaught SyntaxError: Unexpected end of JSON input at JSON.parse (
) - DeprecationWarning: Calling an asynchronous function without callback is deprecated. – how to find where the “function:” is?
- Is there a way to create interfaces in ES6 / Node 4?
- Implementing Isomorphic JavaScript (React JS) in WordPress?
- How to use wp_localize_script in custom page template?
- Dynamically insert values in a WordPress SelectControl Options field
- var is undefined in a Gutenberg block
- AngularJS with route and JSON API
- Why WordPress not using JSON_UNESCAPED_UNICODE by default?
- Connecting a wordpress site to an AngularJS APP