Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
141 votes
8 answers
217k views

How to fetch data from local JSON file on react native?

How can I store local files such as JSON and then fetch the data from controller?
mrded's user avatar
  • 5,054
38 votes
6 answers
64k views

typescript Cannot add headers to a fetch api using react-native

I am using Fetch API from react-native and I am using typescript. My code looks like this: let responseLogin = await fetch('http://url_example', { method: 'POST', headers: {'Content-...
P.Lorand's user avatar
  • 1,464
29 votes
9 answers
36k views

React-Native fetch XML data

I'm new to React-Native. Trying to make some very simple apps. Can't figure out how to fetch XML data. With JSON everything is clear and simple. But how to fetch XML? Tried to convert it to JSON via ...
Toon's user avatar
  • 652
18 votes
1 answer
12k views

What is cause for this issue "Cannot convert argument of type class org.json.JSONArray" in react-native android?

I'm trying to write the plugin to get the applist with package name and icon in the react-native. I'm getting all the required data in the form of JSONArray and the images are getting stored in the ...
coders's user avatar
  • 731
16 votes
2 answers
38k views

How to remove html tags from json data in react native? [duplicate]

In my React Native app i'm fetching json data which contains raw html tags.How to remove the html tags from that?Following is the json response i'm getting [{ "data": { "course": { ...
Anu's user avatar
  • 1,722
15 votes
5 answers
28k views

React Native JSON.stringify cannot serialize cyclical structures

We're building a RN app (RN0.37), and we're running into an issue where when the app is run, we get a "TypeError: JSON.stringify cannot serialize cyclic structures". Nothing of relevance has changed ...
Vicente Opaso's user avatar
14 votes
6 answers
23k views

React Native - Return all JSON data in AsyncStorage?

In my React Native app's AsyncStorage, I have multiple JSON objects, each with a unique key id like so: '62834456': data: { "foo": "bar", "nicknames": [ "grizz", "example" ], ... and so on } ...
zahnzy's user avatar
  • 247
11 votes
2 answers
27k views

write/edit/overwrite a json file in react native

I know how to read the json file just by importing it import file from './config/data.json'; console.log(file); . But is there an easy way to write or edit on it.
Damathryx's user avatar
  • 2,780
11 votes
7 answers
17k views

react native fetch returns Blob instead of JSON after upgrading to 0.24.1

Hi so I’ve recently upgraded to 0.24.1 and I’m having problems with fetch. I’m getting similar issues as this https://github.com/facebook/react-native/issues/6025 but body init is returning a Blob ...
kurupt_89's user avatar
  • 1,583
11 votes
5 answers
71k views

How to get JSON data from fetch (react-native)

I'm writing small app for iPhone using react native. I'm trying to fetch JSON data from a website using fetch. Like in the example: function status(response) { if (response.status >= 200 &...
Michał Zubrzycki's user avatar
10 votes
2 answers
14k views

How do I set multiple values within Asyncstorage

How do I set multiple values within Asyncstorge?.Because I'm trying to set token and user_id .These are the server response values. This is how response looks like json { error: 0, data: 'User ...
Anu's user avatar
  • 1,722
10 votes
2 answers
74k views

How to parse json data in react native

hi I am new to React native development, how to parse following data please help me here is my code componentDidMount() { fetch('https://api.myjson.com/bins/96ebw') .then((response) => response....
Uma Achanta's user avatar
  • 3,699
9 votes
1 answer
6k views

Catch return json from POST with Axios when error 400 (Bad Request) occurs

I am making an http request in an api using React Native with Axios, I can get json and parsear it when the callback is 200, however, for example, when I call a method, for example, to register the ...
Anderson Dev's user avatar
8 votes
2 answers
34k views

React Native JSON Value of type NSDictionary Cannot be converted to NSString

I have an issue with A React Native (version 0.38.0) app I am trying to develop. I am basically learning as I go. I am fetching a JSON from a custom API endpoint. I have managed to loop through the ...
Tex0gen's user avatar
  • 236
8 votes
2 answers
24k views

warn Package undefined has been ignored because it contains invalid configuration. Reason: Cannot find module 'undefined/package.json'

In my app.json folder, I have everything bundled nicely, but I have one undefined package at the bottom of the install list: "undefined": "react-navigation/bottom-tabs" I tried ...
MK_Pierce's user avatar
  • 956
8 votes
3 answers
1k views

Render React Native Elements from JSON

I have searched around...can't quite find what I'm looking for, so I appreciate any help! Here is what I am going for: I am building a CMS-like setup for a React Native app. This is so that an admin ...
Ridge Robinson's user avatar
7 votes
1 answer
10k views

How can I use react-native with php with fetch return data is always null

My return is always null. i cant seems to get this to work. How can I use react-native with php with fetch json. anyone can help? PHP $myArray = array(); $myArray['lat'] = $_POST['lat']; $myArray['...
phongyewtong's user avatar
  • 5,233
7 votes
4 answers
4k views

Javascript - convert an EXTRA LARGE Number to string in JSON before the default parsing

As I mentioned in THIS QUESTION, I have problem when getting the response from the server. I receive an array of objects with these attributes: [{ "Id": 143187001116603, // VERY big number which I ...
MoKhajavi75's user avatar
  • 2,672
7 votes
4 answers
13k views

How to use XML response in react-native

I am developing an mobile application by react-native, I have to call a odata service which returns XML and I need to convert that to json object. How should I do that? return fetch(url, { ...
Reza's user avatar
  • 19.6k
7 votes
1 answer
16k views

Access array of objects to display in React Native Text component

I’m having trouble accessing an array of objects in my JSON data to display in a React Native Text component. JSON data { "name": "Pizza Joint", "when": [{ "day": ["Sat", "Sun"], ...
Michael Mueller's user avatar
6 votes
3 answers
24k views

React Native fetch returns error: JSON Unexpected EOF

I hope someone here can help shred some light on the issue for me. I have been fighting this one error for too long now. I am making a fetch request to an API for a sensor, which results in the same ...
André Gollubits's user avatar
6 votes
2 answers
6k views

React Native Bridging: Passing JSON to Swift function

Im a rookie in Swift and Objective-C but Im trying to make a bridge from React Native to Swift, and send a JSON and a JSON Array as params to Swift. Inside React I would like to call this function: ...
m0rfarpeter's user avatar
6 votes
1 answer
13k views

Looping Json & Display in React Native

How do I go about looping the result i retrieved from Json? render: function() { console.log(this.state.list); contents = ( <View style={ styles.content }> <Text>...
CodeGuru's user avatar
  • 3,725
6 votes
2 answers
1k views

Getting undefined when json fetch in react native

In my simplified code below I am able to pull data in JSON format but if I try to console log a specific key of the object, I get undefined. I had thought I could use this.state.profile.name to ...
Steven Sheffey's user avatar
6 votes
3 answers
17k views

How to handle null response in fetch api

I building a react-native app and using fetch api for handling server request, it is working fine if json returned from the server is not null, but if the response from the server is null it will give ...
Manjeet Singh's user avatar
6 votes
0 answers
1k views

React-Native App with a Apple Watch App

I have a react-native based question, we are building a react-native application that will use authentication to call a secured API for data. This is all built in react-native, however I am wanting ...
Matthew Sheets's user avatar
5 votes
5 answers
7k views

How to save imported JSON file with Expo Filesystem

I have been working on a React Native project with Expo that uses a json file to store local data. I am importing the data like so import data from '../database.json' I am making changes (adding and ...
TheSaltyPug's user avatar
5 votes
7 answers
19k views

How to add icon left side in InputText in React Native

I am creating an App & I am working on the login screen. I need help to add user icon inside of Username field & password icon inside of a password field. I want to make it more beautiful app....
Adeel Ahmed Baloch's user avatar
5 votes
1 answer
15k views

Get json from jsonp fetch promise

I am just starting with react-native, and I'm doing the classic example in the docs as a base... fetch('https://facebook.github.io/react-native/movies.json') .then((response) => response.json()) ...
Ian's user avatar
  • 13.8k
5 votes
1 answer
4k views

How to add environment variables to app.json file

I have an app.json file in my Expo project. In this file I have two API keys (labeled API_KEY below) that I'd like to hide via environment variables. How can I go about using environment variables ...
devon66h's user avatar
  • 507
5 votes
1 answer
13k views

React-Native: Flatlist nested in SectionList

I am trying to render a couple of flatlists in a sectionlist. The end goal is this: However, I can't seem to get it to render properly. It renders the same item multiple times. <...
Kartikeya Sharma's user avatar
5 votes
3 answers
5k views

JSON parse emoji unicode crashing my react native project

Whenever I try to display some data fetched in my React Native project from my API endpoint I get this JSON parse error: JSON parse error on line 0 near .."}], [18933, "RC': expected another Unicode ...
Eugene Yakovlev's user avatar
5 votes
1 answer
8k views

React native http post got Json Parse error: Unrecognized token '<'

When I tried to post data from react-native to PHP API, react-native show the error: Json Parse error: Unrecognized token '<' I tested PHP API by postman with the header type 'application/...
Justin's user avatar
  • 307
5 votes
5 answers
15k views

How to access local image URL in a json file

I have problem in accessing the local image url in a json file. Below are all the approaches I have tried but none of them works. // json { "image": "./images/example.jpg", } // React Native ...
Stephan's user avatar
  • 375
5 votes
5 answers
2k views

Failed to read native JSON Data

I am trying to build an old project using Android studio but the process fails. The error message I get is this: Error:Failed to read native JSON data Use JsonReader.setLenient(true) to accept ...
despinac's user avatar
  • 103
5 votes
1 answer
12k views

React-Native Rendering json flatlist

I am new to react-native. I'm building up complexity but have gotten stuck on rendering FlatList items from a json list. This was working fine for ListView but not able to figure out what I am missing ...
James's user avatar
  • 169
5 votes
0 answers
1k views

JSON Streaming in React Native

I'm building a React Native app that has to listen on a JSON stream, something similar to node's JSONStream/EventStream style (https://www.npmjs.com/package/JSONStream) . Packages like JSONStream can'...
sparkFinder's user avatar
  • 3,384
4 votes
4 answers
735 views

Getting undefined value when I access value of an object

Inside loginUser function, I want to access the value of accessToken which is in side the 'stsTokenManager' but when i try to access this value then i am getting 'undefind' value. import React, { ...
surya's user avatar
  • 169
4 votes
1 answer
13k views

react native how to filter data with some key object on json

if I have json like this ----------------- { title: "The Basics - Networking", description: "Your app fetched this from a remote endpoint!", movies: [ { title:...
boy_v's user avatar
  • 607
4 votes
2 answers
23k views

React-Native: Display JSON Data in ListView

I want to display JSON-Data in a ListView. The Problem is, that the JSON data contains Dictionaries. In one Row I would like to display 'Gattung', 'ab' and 'bis'. I am not able to display following ...
profidash_98's user avatar
4 votes
1 answer
10k views

React-Native JSON fetch from URL

I hope I could find some help to the issue. I'm using React Native and try to get some data from an API called Feiertage-API (https://feiertage-api.de/), that basically returns (should return) the ...
Sercan Samet Savran's user avatar
4 votes
3 answers
3k views

React Native fetch() returns odd json response items

I'm trying to get data as JSON from service called OpenWeatherMap, so in my componentWillMount method I'm calling fetch() to return data by url. My code for now is: this.weather = fetch(url).then(...
Ilyas Khametov's user avatar
4 votes
3 answers
39k views

How to map json data with array in react native

I have array like this in react native const data = [ { key: 1, label: 'Service1'}, { key: 2, label: 'Service2' }, { key: 3, label: 'Service3' }, { key: 4, label: 'Service4' }, {...
Sugeivan Senthinathan's user avatar
4 votes
6 answers
12k views

React-Native Fetch "POST" request throwing "SyntaxError: Unexpected end of JSON input" in Android

this is my function don't know where is the problem fetchData() { fetch(REQUEST_URL, { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': ...
Hafiz Awais Saleem's user avatar
4 votes
2 answers
7k views

How to map through an array in React without ids?

I have a fairly standard array: ["value","value","value"] If I want to iterate through it, each list item needs a unique key. But how would I do this in this case? JSONs often come with an id -but ...
George Welder's user avatar
4 votes
1 answer
4k views

How to manipulate fetch response for single object JSON in react-native

I am creating my first mobile app using react-native. I am using axios to fetch data from a wordpress website. I managed to successfully get data from an array JSON with a list of musical tracks. I ...
Bogdan Szekely's user avatar
4 votes
1 answer
16k views

react native json response check if string or object

sorry for the silly question. I am relatively new to react native. I have got fetch working so I can get the json response back from the server. The server API returns a string if there is an error or ...
dogwasstar's user avatar
4 votes
2 answers
16k views

Putting a variable inside render() return - React Native

I am mapping json data and can console.log my result, but I can't insert those values in the render. Here is the code I have for my render: data_use = responseJson; const result_id = data_use....
Laney Williams's user avatar
4 votes
1 answer
4k views

How to add a nested List of objects in Realm "Error: JS value must be of type: object"

I'm trying to create Realm database that has a json array of objects with a nested array of objects. When I try to add using the code below I always get the error: JS value must be of type: object. ...
Kaleb Portilho's user avatar
4 votes
2 answers
6k views

react-native - Image require local path from JSON

Hello comunity :) I am working on a testapp in react-native and try to get Images from a local storage place. Actual what i am doing: I give an image directlink source to a var and call this method at ...
Jonathan Stellwag's user avatar

1
2 3 4 5
25