$.getJSON(staticMS, function(data) {
stockData = data.products_and_categories;
console.log(stockData);
var typeData = JSON.parse(stockData)
console.log(typeData.itemType);
});
Not sure whats wrong with this, I keep getting a "Uncaught SyntaxError: Unexpected token o in JSON at position 1" error. Trying to access part (itemType is specific earlier in the script) under the products_and_categories part of JSON file.
Tables under products and categories (after i click on 'object' in console):
Accessories: (8) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
Hats: (6) [{…}, {…}, {…}, {…}, {…}, {…}]
Shirts: (7) [{…}, {…}, {…}, {…}, {…}, {…}, {…}]
Pants: (5) [{…}, {…}, {…}, {…}, {…}]
stockDatais not a valid JSON string.console.log(stockData);this line shows on console.products_and_categoriesinside thedataobject. What I see is there is something valid likedata.Accessories