The JSON you posted looks fine, however in your code, it is most likely not a JSON string anymore, but already a JavaScript object. This means, no more parsing is necessary.
You can test this yourself, e.g. in Chrome’s console:
new Object().toString() // "[object Object]" JSON.parse(new Object()) // Uncaught SyntaxError: Unexpected token o in JSON at position 1 JSON.parse("[object Object]") // Uncaught SyntaxError: Unexpected token o in JSON at position 1
JSON.parse()
converts the input into a string. The toString()
method of JavaScript objects by default returns [object Object]
, resulting in the observed behavior.
Try the following instead:
var newData = userData.data.userList;
Related Posts:
- SyntaxError: Unexpected token o in JSON at position 1
- SyntaxError: Unexpected token o in JSON at position 1
- SyntaxError: Unexpected token o in JSON at position 1
- SyntaxError: Unexpected token o in JSON at position 1
- “SyntaxError: Unexpected token < in JSON at position 0"
- How to get all place details from a Place Details Request using Google Places API Web Service?
- What is JSONP, and why was it created?
- TypeError: Converting circular structure to JSON in nodejs
- Use a JSON array with objects with javascript
- Array of JSON Objects
- Chrome sendrequest error: TypeError: Converting circular structure to JSON
- Fetch: POST JSON data
- How to read an external local JSON file in JavaScript?
- How to read an external local JSON file in JavaScript?
- What is the convention in JSON for empty vs. null?
- What is the “right” JSON date format?
- AngularJS- Login and Authentication in each route and controller
- Nested JSON objects – do I have to use arrays for everything?
- Uncaught TypeError: Cannot read property ‘length’ of undefined
- What is the “right” JSON date format?
- TypeError: Cannot read property ‘then’ of undefined
- How to Create simple drag and Drop in angularjs
- Working with $scope.$emit and $scope.$on
- Failed to load resource: net::ERR_FILE_NOT_FOUND loading json.js
- jQuery AJAX cross domain
- In angularjs we are having ng-disabled directive, why ng-enabled directive is not provided by the framework as we are having ng-show and ng-hide
- Regular expression : match either of two conditions?
- AngularJS : Factory and Service?
- Uncaught TypeError: Cannot read property ‘props’ of null
- Give a value to an ng-model=”searchText” input based on list item clicked in Angular JS
- Loading local JSON file
- TypeError: Cannot read property ‘get’ of undefined on AngularJS
- node.js TypeError: path must be absolute or specify root to res.sendFile [failed to parse JSON]
- Uncaught TypeError: data.push is not a function
- React Js: Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
- Blocked script execution in because the document’s frame is sandboxed – Angular application
- How to convert selected HTML to Json?
- Angular JS Uncaught Error: [$injector:modulerr]
- Use of $parse in angular js
- How to set the id attribute of a HTML element dynamically with angularjs (1.x)?
- Using $setValidity inside a Controller
- How can I group data with an Angular filter?
- How to get JSON from URL in JavaScript?
- How do you put an image file in a json object?
- push object into array
- JSON.parse() not working
- Disable Chrome strict MIME type checking
- react router v^4.0.0 Uncaught TypeError: Cannot read property ‘location’ of undefined
- Refused to execute script, strict MIME type checking is enabled?
- Error: [ng:areq] from angular controller
- TypeError: res.json is not a function
- Understanding the ngRepeat ‘track by’ expression
- SyntaxError: Unexpected token C in JSON at position 0 – Ionic 2 Http GET request
- SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
- Add new attribute (element) to JSON object using JavaScript
- SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
- why angularjs ng-repeat not working
- How to display raw JSON data on a HTML page
- How to connect signalR from angularJs
- Array Mapping in AngularJs
- JSON.parse unexpected token s
- AngularJS errors: Blocked loading resource from url not allowed by $sceDelegate policy
- How to filter JSON Data in JavaScript or jQuery?
- How do you serve a file for download with AngularJS or Javascript?
- Failed to execute ‘postMessage’ on ‘DOMWindow’: https://www.youtube.com !== http://localhost:9000
- How to add a button dynamically using jquery
- How to redirect to another page using AngularJS?
- Complex JSON nesting of objects and arrays
- Uncaught SyntaxError: Unexpected token with JSON.parse
- Why is this simple AngularJS ng-show not working?
- How can JavaScript save to a local file?
- How to enable CORS in AngularJs
- Write / add data in JSON file using Node.js
- How do I handle newlines in JSON?
- Finding the max value of an attribute in an array of objects
- Defining a HTML template to append using JQuery
- How do I bind to list of checkbox values with AngularJS?
- “NS_ERROR_DOM_BAD_URI: Access to restricted URI denied”
- parsing JSONP $http.jsonp() response in angular.js
- AngularJS POST Fails: Response for preflight has invalid HTTP status code 404
- What is the cause for “angular is not defined”
- $http.get(…).success is not a function
- Unexpected token < in first line of HTML
- ngular is automatically adding ‘ng-invalid’ class on ‘required’ fields
- Uncaught SyntaxError: Unexpected end of JSON input at JSON.parse (
) - WP Rest API – How to get featured image
- 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
- 404 Error Contact Form 7 on WordPress
- AngularJS with route and JSON API
- Pass data from wordpress to javascript in JSON
- How to include a JSON file on my page?
- Why WordPress not using JSON_UNESCAPED_UNICODE by default?
- how to use nimble-API and Display data?
- Remove escape characters from JSON string pulled from a database
- I would like to retrive JSON value and display it in wordpress page or widget
- Connecting a wordpress site to an AngularJS APP
- Gutenberg core/file add style support in js/ json