json


TypeScript Access Data from a Successfully Received Promise


I am using the React Framework with TypeScript.
My Problem is that I am trying to access Data from a successfully received promise using the fetch-method. So that i can already see (in the browser console) that there is an array with the needed data containend in the promise. That's my browser console output: Chrome Console Output
The fetch is beeing executed as soon as the component mounts and saves the results in the state:
constructor(){
super();
this.processJSON = this.processJSON.bind(this);
this.state = {
buecherJSON : []
}
}
componentDidMount() {
fetch('http://localhost:8080/buecher/findAllByIsbnIsBefore?anzahl=2')
.then(results => {
this.setState({
buecherJSON : results.json()
});
})
.catch((error) => {
console.error(error);
});
}
In separate method I want to process the JSON formatted data to make an object out of it. But I can't figure out how to make that. So i far i got this (which is basically doing nothing):
processJSON(){
var buecherJSON = this.state;
console.log(Object.assign({},buecherJSON));
}
How can I map the received JSON to an accessible array in TypeScript?

Related Links

How to call a function passed as a string in a json string
How to save a csv File using fast-csv that every attribute is in OWN column
jq to convert text string lists into json
Football nested JSON object
Osb 11g call rest json
Sending json as Gzip in https in xamarin.forms for android
POST JSON object to aws lambda
LIferay:Download document using Liferay JSONWS webservices
convert input excel stream to json in python
WSO2 DAS - Sending multiple events using JSON
How do I iterate on a Map object returned from JsonSlurper.parse(JSONFile)?
Validating trello board API responses in Python unittest
How to compile JSON1 extension for sqlite3?
D3 Line Generator Handling Multiple Arrays
Chart.JS Underfined with JSON
Can't use JSON Extractor or jp#gc - JSON Path Assertion to confirm a value in a response

Categories

HOME
paypal
visual-studio-2015
converter
itext
bing
facebook-graph-api
qpython3
deep-linking
playframework
codeeffects
chaiscript
wampserver
gspread
iis-7.5
file-io
vsftpd
subquery
dropbox
click
window
cockroachdb
xlsx
future
typeahead
quartus
pyephem
distance
kitematic
onsen-ui
memsql
npm-install
croppic
sumo
compare-and-swap
emv
chrome-native-messaging
partial-application
forum
ivy
red-black-tree
postgresql-9.2
geomesa
wsadmin
dart-pub
bayesian-networks
apiary
photon-controller
modelattribute
pdflib
pydio
uiprogressview
django-filer
amf
boost-hana
date-format
django-south
proxygen
group-concat
qt-linguist
web-essentials
data-import
application-loader
zuora
built-in
twitter-rest-api
apache-mina
uos
low-level
word-2013
client-side-validation
cocoascript
left-recursion
suffix-array
picat
resource-files
exiv2
sim900
image-zoom
entity-framework-4.1
adomd.net
zend-lucene
transitive-closure-table
zend-framework-modules
css-tables
rose-db-object
separation-of-concerns
wchar
curljs
gtk2hs
noir
for-xml-path
zend-form-element
chatroom
hardware-acceleration
osx-leopard
winverifytrust
system-codedom-compiler
evb
virtualquery

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App