Download and read gzipped JSON data with Javascript -


you can manually download following link:

http://saved-games-alpha.s3-website-us-east-1.amazonaws.com/jghre-0gmk@.json.gz

it's gzip file. unzipping yields file called "temp" has json data want in it.

i need greasemonkey script automate this. when run

const gzip = jquery.get("http://saved-games-alpha.s3-website-us-east-1.amazonaws.com/jghre-0gmk@.json.gz"); 

i successful response, don't know json.

console.log(gzip);               // response object console.log(gzip.responsetext);  // undefined, can see in inspector binary 

i trying use gunzip library here @ json, firefox console shows nothing after call

const json_data = jxg.decompress(gzip.responsetext); 

how access json data?

important code:

const uri = "http://saved-games-alpha.s3-website-us-east-1.amazonaws.com/jghre-0gmk@.json.gz"; console.log(uri); const gzip = jquery.get(uri);  console.log("gzip got"); console.log(gzip); console.log(gzip.responsetext);  console.log(jxg);  const json_data = jxg.decompress(gzip.responsetext);  console.log("json: " + json_data); // doesn't appear in console 

console output: see http://i.imgur.com/kuyi8fe.png

you can work data ajax request returns call or result of promise. see complete here: http://api.jquery.com/jquery.ajax/


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -