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

CSV to load data into neo4j and display in web using d3.js versus displaying json data directly on web page using d3.js
Azure does not accept json format for routing in IoT hub
Atom snippets not matching the word I write
Angular2 - how to destructure a Rails json error response into a string
Writing JSON object to a JSON file with fs.writeFileSync
jq trying to iterate over two sets of values
Annotations not showing on map
Q: Spark - Reading JSON Files leads to 'matches 0 files' error
Updates to JSON field don't persist to DB
Angular2 - Put a component between elements
Github API v3 JSON passing
What is the most efficient way to aggregate a value from a JSON tree in d3.js?
Extracing value from json using json path
react native dry conditional statement
Is it bad practice to display user input in JSON responses for error messages?
How to make alert on Alamofire request swift 3

Categories

HOME
sharepoint
rest
cntk
reverse-engineering
angular-cli
ncurses
translation
apple-numbers
algorithmic-trading
yocto
eval
vuex
unity2d
eclipse-cdt
hashicorp-vault
rapidjson
prestodb
rails-activerecord
apple-tv
cocoa-touch
samsung-mobile
compare-and-swap
cep
chrome-native-messaging
dpi
nesc
hana-studio
invoke-command
websauna
crt
graph-databases
fractals
lego
oscommerce
es-shell
brute-force
android-preferences
viewgroup
android-maps-v2
html-agility-pack
encapsulation
context-free-language
archer
onmouseover
floor
uiviewpropertyanimator
jgraph
xmgrace
crystal-reports-8.5
infinite-scroll
unity3d-editor
restivejs
keycode
gradle-script-kotlin
windows-azure-pack
rstudio-server
update-site
spoofing
dojox.charting
cmocka
brackets-shell
license-key
self-hosting
hyperthreading
document-oriented-db
datasnap
selendroid
textkit
futuretask
programming-paradigms
twython
prezto
pgm
belongs-to
odftoolkit
fragment-tab-host
aquafold
neoload
korma
wss
joox
logentries
document-database
confusion-matrix
sttwitter
dig
nuspec
shortcuts
adomd.net
symphony-cms
template-haskell
angularjs-timeout
android-4.0
blockingqueue
static-variables
rose-db-object
expression-evaluation
path-manipulation
gtk2hs
port-scanning
loadui
clients
grooveshark
scatterview
kpi
standardized
hardware-infrastructure

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