Skip to content
Advertisement

Tag: json

Loop through a nested JSON object

I’m looking for a solution to loop through a nested JSON object in pure JS. Indeed I’d like to console.log every item and each of its properties. Answer You are accessing an object’s value using its key in json_object[item] so just keep drilling down into the object.

React Hooks TypeError: todos is undefined

I am using PERN Stack with bootstrap for styling. So, I want to access my JSON data and show it in the form of todo lists. When I tried using map function I got TypeError: Here is the code: Answer I misspelled my variable. So, the problem was I was writing jsonData.data.todos instead off jsonData.data.toDos .

Get to second level array in JSON

im more of a designer and less of a programmer so any help is greatly appreciated. The idea behind this project is to generate a dropdown menu using the “name” from the data json and when selected the “stock” information will appear as well. I’ve been able to get to the “name”:”Pantone 12345″ but when i try to access the

React – how to display all products using dropdown?

First time trying to do this so please bear with me. I’m using a dropdown to filter product data from a local JSON file based on category. The code below does filter and display the products based on category when a user selects a category. However I’d like to show all of the products on load before the user selects

Advertisement