How to save a json-File so that it is readable in ionic


#1

i was able to finish the json tutorial from this video:

however, when i try to change the json-file to a json-file of my own (or even download the json-file from the tut an upload it to my server) it dosn’t display anything then:

-> so: why is:

loadData(){
let data:Observable;
data = this.http.get(‘https://jsonplaceholder.typicode.com/posts’);
data.subscribe(result => {
this.items = result;
})
}

working,
but if i copy the jsonfile to: “http://mydomain.com/xyz.json

loadData(){
let data:Observable;
data = this.http.get(‘http://mydomain.com/xyz.json’);
data.subscribe(result => {
this.items = result;
})
}

isn’t working anymore!??

how can i fix this? / how do i save the jsonfile: ‘https://jsonplaceholder.typicode.com/posts to my server to change the data/read it from my server? thx


#2

Try using https instead of http.


#3

unfortunately

data = this.http.get(‘https://mydomain.com/xyz.json’);
isn’t working neither… :confused:

Any other ideas what could be wrong/how to fix this?

-> so why is: https://jsonplaceholder.typicode.com/posts
working, https://jongliertricks.de/api/x.json with identical text isn’t?

in the working example the name is: https://jsonplaceholder.typicode.com/posts (without.json) at the end. how did they save it/what is the filename of the json? thx