All Questions
71 questions
0
votes
1
answer
39
views
How can I fetch, acces the data?
I have a JSON file with nested elements and I just can`t figure out how to display the data from the file.
I tried to use Object.keys(), Object.values() and Object.entries() but all I get are errors ...
-1
votes
2
answers
64
views
Why is my code not adding data to my json file?
I'm making a sign-up page, and can't seem to come across why it's not working.
Edit: updated the code to remove the userObject. Still am not able to get the code to actually post the data to my json ...
-2
votes
4
answers
121
views
how can i get a object from json in react?
i have to get some data from a complex objects json (in my case is: valor_custo_fornecedor from the detalhe object, how can i do this ?
i already tried with axios like this:
const [valorCusto, ...
0
votes
1
answer
51
views
JSX Script : the prompt isn't showing up
Hey there I'm making a script to export JSON file from Adobe Illustrator
// Helper function to export prefixed objects
function exportPrefixedObjects(doc) {
// get prefixes and reference point as ...
0
votes
3
answers
470
views
How can i access this p tag content in react?
I have this obj, I want to access this p tag content and render it through props. Without dangrouslySetInnerHTML method. What should I've to do?
let content = {
para: `<p>A listing page is ...
0
votes
0
answers
98
views
Modal shows up with an empty array
working on a project with ReactJS in which data gets pulled from their api and gets loaded as modal on the page, I want to display the table obtained through my api called by Axios, if I click on the ...
-1
votes
1
answer
57
views
Setting a new variable from a JSON variable React
I am making a react football app. One of my components should show more details about a fixture when selected from a list of fixtures. I am setting the fixture by importing the ID from a click and ...
0
votes
1
answer
492
views
Accessing a variable set in one component file in another file React js
I am quite new to react and am trying to create a sports fixture application where when you click on one of the fixtures in the list it takes you to a new page with more things you can do for that ...
-1
votes
1
answer
6k
views
Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON, Getting HTML response instead of JSON
Context: I have been working on a project (called Music Master) on which i have to access details of artist from developer.spotify.com.
The following is the code snippet:
const BASE_URL = 'https://api....
0
votes
0
answers
1k
views
Absolute imports aren't working in ReactJS
I have a ReactJS project called my-app, that was created using the Redux+TS template.
It's folder structure is like this:
node-modules
public
src/
components/
Controller.jsx
App.jsx
...
0
votes
3
answers
339
views
I try to display api data but nothing comes out, not even an error on React
I'm slowly understanding the services and fetch with React but when I try to show something, it shows me absolutely nothing. I put the code in case someone can help me. Maybe I have to look at how to ...
0
votes
1
answer
2k
views
ServerError: Invalid JSON response body... in NextJS app with fetch
I have a nextJS app running locally, I also have a flask api running locally. I know the flask is returning proper json through Postman. The results from the get request to that are below:
{
&...
0
votes
1
answer
60
views
how to put API status json in the state?
I need to put the json in the register state to use it in different parts of the project
But unfortunately, after console.log(register); from that state, it returns an empty object in inspect
import ...
-3
votes
1
answer
2k
views
Accessing a nested JSON object to read into a table in React [closed]
I have a JSON object which I'm trying to parse into a table using React, however I'm having trouble using .map() to try to create a row for every unique combination of course code, name, ...
-2
votes
1
answer
90
views
Iterate over an object returned by fetch and combine two values
Working on recipe finder app using React & Mealdb api, below is the json retruned when I fetch, https://www.themealdb.com/api/json/v1/1/search.php?s=Arrabiata.
I am struggling to work out how to ...
0
votes
1
answer
2k
views
Using Axios to delete from a JSON server in React with a <button>
With my current application, I fetch the contents from the JSON server and display them with having a delete <button> next to them. I want to delete an entry while using window.confirm to ...
-1
votes
1
answer
439
views
How to get JSON object key value pairs to be on its own line [duplicate]
I have a json object stored inside as an object called
job
It renders as
{"amount": " 12185","job": "GAPA","month": "JANUARY","year&...
-1
votes
1
answer
691
views
React / React Native: How to Map over array and show Data on Cards
Im trying to .map() over my array and render cards to the dom. I can show everything in the second object on my card but i cant show source.name ("Engadget") on the card.
I guess because its ...
-2
votes
2
answers
63
views
Render card based on pet type
I'm trying to render a card when it's a cat with a purple background and a card with a background blue when it's a dog based on type. the card is designed to be unique to each animal.
dog card
cat ...
1
vote
1
answer
296
views
Cant access second child object of an object api response in react
I cant access the second child object of an object which was generated through an api response. This is the weather api i am using https://www.weatherapi.com/. Look under Display.js for more ...
2
votes
1
answer
243
views
How to import data from a JSON file in React?
I am trying to import data from a JSON file (a list of animals) into a React component.
I am getting this error:
TypeError: Cannot read property 'map' of undefined.
I can't figure out why though, ...
0
votes
1
answer
624
views
Failed prop type: Invalid prop `source` supplied to `Image`
i try to fetch URI image from a api but it throws me the following error:
I've been looking for this information, but I can't find a case like mine
it does not show the image, but if it passes the ...
-3
votes
2
answers
2k
views
How do I remove double quote "" from JSON Value [closed]
I am doing my Javascript. And just imported JSON and printed it out with JSON.stringfy
I am using that site because the JSON contains the URL which I want to link.
I am not getting what I really need ...
-1
votes
1
answer
118
views
How to append data on JavaScript?(React.js) [duplicate]
I want to append some JSON data to frontend(React.js)
After fetching the JSON data, I want to append the data to JSX.
The data looks like below:
(The value of description is string)
data = { ...
0
votes
1
answer
115
views
how to output a json image file extension from a react applicaiton
I am trying to output images from a JSON file with a image file name. Let me explain it.
Now the JSON file with the list of product are located under:
frontend > src > product.json
Here is the ...
0
votes
2
answers
575
views
Create react table dynamically going top to bottom
PROBLEM: I am attempting to create a table component that maps column-wise. All the previous questions I am finding maps row which I cannot do considering how the data is formatted. I am adding an ...
1
vote
2
answers
900
views
React: Merging nested json data with parent data to create multiple objects
I have an API call to an JSON file which has some events. This events have one title but several showtimes. Is it possible to merge the nested array with the parent object and thus, creating n new ...
-1
votes
4
answers
333
views
How to iterate over nested JSON with Map in JSX
Not sure how to access the inner part of the json object. I've tried using Map to iterate through the location part and get the capital but I get the error Cannot read property 'map' of undefined
If ...
0
votes
2
answers
198
views
retrieve data from external json file
i have a json file with some data in it and a jsx file with a button and a div so i want to retrieve the json data when i click the button inside my jsx file into the div i have and i don't have a ...
0
votes
2
answers
796
views
Map nested JSON object in React
I spend few hours trying to figure this one out, and completely failed. I need your help.
I have a JSON file that I want to loop though and create a UI that has multiple columns that have multiple ...
2
votes
0
answers
24
views
How to get JSON data with two dynamic variables? [duplicate]
It's my first post here so if I'm doing something wrong please tell me!
I'm still learning React and am working on a project for university.
I'm trying to get the length from my JSON while having two ...
1
vote
1
answer
117
views
Trying to display JSON by sections in React JS
The Problem:
This is how the App is supposed to render the contacts, organized by sections according to their first name letters - A,B,C... So far i couldn't figure a way to diplay them in this way ...
1
vote
2
answers
343
views
Data fetched from JSON is logged multiple times on pressing Enter key
I am making a search functionality in my React website, when the user enter a keyword in the search input the keyword is matched in json, if the same is found in it then yes is logged, or else nothing ...
1
vote
5
answers
2k
views
How to show nested json on Ui using react
I have a nested JSON, by which I am making a UI, I have successfully created the first part, Issue I am facing is for the second part.
What I am trying to do
I have a nested json by which I am showing ...
0
votes
5
answers
4k
views
JSON.parse returning undefined on my string
I have a returned string from my server and I want to parse it into a JSON object, the following is the string and what I am doing :
stringToParse = "\"{'female': 16, 'brand': 75, 'male': 8}\...
2
votes
2
answers
5k
views
How to get a specific value in an Object in React Native?
I'm currently coding my first app using React Native and using iTunes' search API.
I put a TextInput and a Button which returns all the albums corresponding to the text. Once you click an album, it ...
1
vote
2
answers
1k
views
I am trying to put a list of countries in a .js file and export it for reuse. Getting errors
I am building a react/material-ui site and want to create a countries.js file that has the following in it (as an example)
export default const countryList = [
{
"label": "...
0
votes
1
answer
3k
views
Rendering JSON child list from object list in ReactJS [duplicate]
I have JSON data like this. I want to render the child object title. But it says "index.js:1 Warning: Each child in a list should have a unique "key" prop."
[
{
"title": "Components",
"...
1
vote
1
answer
719
views
Convert Object to Array returns Undefined
Here is the object I'm trying to convert into array:
{ 1: {..}, 2: {..}, 3: {..}, 4: {..}, 5: {..}}
This is the function I'm using to convert the Object into array:
const convertObjectToArray = (...
0
votes
1
answer
57
views
React parsing JSON data with multiple worded identifier
I am trying to access JSON data however the JSON identifiers use multiple words. The JSON data is formatted like:
"Meta Data": {
"1. Information": "Intraday (5min) open, high, low, close ...
1
vote
2
answers
160
views
Get <option> attributes in<input>
I have function that is returning me options for :
const codesList = () => {
return businessCodes.map((code, index) => {
return <option key={code.BusinessCode}>{code.IndustryName}&...
0
votes
3
answers
162
views
Iterating over array inside object in JSX giving undefined
I am fetching data from my API :
fetch('/api/p/' + project_id).then(res => res.json())
.then((project) => {
console.log(project)
this.setState({ ...
0
votes
1
answer
1k
views
How to pass an array as props in React without being converted to string
I'm developing a university administration website with React that can be displayed in different languages. So far, I have developed the Login page, please see the code (note that I'm using Babel):
...
-1
votes
7
answers
765
views
How to correctly wrap JSX elements and display JSON depending on selection
I'm developing a university administration website with React that can be displayed in different languages. So far I have developed the Login page which looks like this:
At this point, I'm trying to ...
0
votes
3
answers
212
views
Display data from a local JSON file
I'm learning to code in React from Tyler Mcginnis' React course (which I strongly recommend btw) and I decided to develop my own project, a university administration website, which can be displayed in ...
0
votes
3
answers
252
views
How to Loop Through Firebase JSON in React
I have the following JSON Data coming out of Firebase RTDB:
{"\"1\"":{"itemDescription":"This is a description of the item.","itemName":"Item Name","itemValue":{"costAmount":200,"costType":"dol"}},
"\...
1
vote
1
answer
78
views
How do I add State into dynamic UI controls?
I'm trying to add some state to some dynamic UI controls created with ReactJS. I'm getting the error
Uncaught TypeError: _this.setState is not a function
I've basically got a really good sample from ...
0
votes
2
answers
2k
views
Replace content via scripting in batch of smart objects(Replace layers) in photoshop cc 20.0.0
So I have these 28 *.tif image files as 28 layers (smart objects) I have arranged in a .psd file and wish to replace each layer with another .tif file. I wish to run some script(jsx) with loop ...
-3
votes
1
answer
61
views
Changing collection used for display in React
I have a react app which fetches products from json file, I have added two buttons on the top of the page so that each one of them will show the data from its json state.
so there is menu1 state and ...
0
votes
1
answer
61
views
Item's unique onclick
I have built a react application which shows items from JSON file, it consists of 4 main components, Items.js which created the item itself alongside its props (title and image), Itemlist.js which ...