Recently, when I was working on a project, I used $. Each() to traverse the JSON data passed from the background. Uncaught type error: cannot use ‘in’ operator to search for this error occurs when directly traversing the passed data
Later, we found out the reason through the students’ discussion and online query, because what we passed from the background is JSON data, but the data we traversed by $. Each() is JavaScript objects; So I’m going to pass it to a JavaScript object
You can use JSON.Parse() | $.Parsejson() to convert
=====Error code
=====Correct code
Similar Posts:
- How to Solve Error: Unexpected token o in JSON at position 1
- [Solved] TypeError: string indices must be integers, not str
- When parsing background JSON data with Ajax: unexpected token o in JSON at position 1
- Uncaught SyntaxError: Unexpected token o
- [Solved] Error-Javascript: Uncaught Error: Malformed UTF-8 data at Object.stringify (crypto-js.js:478) at W…
- Uncaught typeerror: the solution of illegal invocation problem
- Python TypeError: Object of type int64 is not JSON serializable
- How to Solve Error Unexpected token u in JSON at position 0
- Django: How to Convert Models object to JSON