Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

Commonmark migration
Source Link

I've been trying to access the JSON from [this API][1]this API. However, when I run a request to retrieve the JSON I'm met with the following list when I run this code.

const request = require('request');
var url = 'https://api.collegefootballdata.com/rankings?year=2019&week=10&seasonType=regular'
request(url,(err, res, body) => {
 if(!err && res.statusCode == 200) {
 var obj = JSON.parse(body);
 console.log(obj);
 }
});

My output:

[
 {
 season: 2019,
 seasonType: 'regular',
 week: 10,
 polls: [ [Object], [Object], [Object] ]
 }
]

My problem here lies in the fact that I want the information from each POLL (5 polls listed as objects in the JSON by following the link, however I cannot figure out how to WORK with this.) For example, I would want to call polls[0].rank to populate a list of the top 25 teams from the poll.

Accessing the arrays of objects inside nested JSON has obviously been a problem for me in Node, and would love to get started on the right foot when working with this project. [1]: https://api.collegefootballdata.com/rankings?year=2019&week=1&seasonType=postseason

I've been trying to access the JSON from [this API][1]. However, when I run a request to retrieve the JSON I'm met with the following list when I run this code.

const request = require('request');
var url = 'https://api.collegefootballdata.com/rankings?year=2019&week=10&seasonType=regular'
request(url,(err, res, body) => {
 if(!err && res.statusCode == 200) {
 var obj = JSON.parse(body);
 console.log(obj);
 }
});

My output:

[
 {
 season: 2019,
 seasonType: 'regular',
 week: 10,
 polls: [ [Object], [Object], [Object] ]
 }
]

My problem here lies in the fact that I want the information from each POLL (5 polls listed as objects in the JSON by following the link, however I cannot figure out how to WORK with this.) For example, I would want to call polls[0].rank to populate a list of the top 25 teams from the poll.

Accessing the arrays of objects inside nested JSON has obviously been a problem for me in Node, and would love to get started on the right foot when working with this project. [1]: https://api.collegefootballdata.com/rankings?year=2019&week=1&seasonType=postseason

I've been trying to access the JSON from this API. However, when I run a request to retrieve the JSON I'm met with the following list when I run this code.

const request = require('request');
var url = 'https://api.collegefootballdata.com/rankings?year=2019&week=10&seasonType=regular'
request(url,(err, res, body) => {
 if(!err && res.statusCode == 200) {
 var obj = JSON.parse(body);
 console.log(obj);
 }
});

My output:

[
 {
 season: 2019,
 seasonType: 'regular',
 week: 10,
 polls: [ [Object], [Object], [Object] ]
 }
]

My problem here lies in the fact that I want the information from each POLL (5 polls listed as objects in the JSON by following the link, however I cannot figure out how to WORK with this.) For example, I would want to call polls[0].rank to populate a list of the top 25 teams from the poll.

Accessing the arrays of objects inside nested JSON has obviously been a problem for me in Node, and would love to get started on the right foot when working with this project.

deleted 145 characters in body; edited title
Source Link
Jonathan Hall
  • 80.5k
  • 19
  • 163
  • 207

Accessing JSON objects nested inside array (Node.js)

This should be a simple fix but I can't find solutions anywhere for my specific problem. I've never worked with JSON before so bare with me, but I've been trying to access the JSON from [this API][1]. However, when I run a request to retrieve the JSON I'm met with the following list when I run this code.

const request = require('request');
var url = 'https://api.collegefootballdata.com/rankings?year=2019&week=10&seasonType=regular'
request(url,(err, res, body) => {
 if(!err && res.statusCode == 200) {
 var obj = JSON.parse(body);
 console.log(obj);
 }
});

My output:

[
 {
 season: 2019,
 seasonType: 'regular',
 week: 10,
 polls: [ [Object], [Object], [Object] ]
 }
]

My problem here lies in the fact that I want the information from each POLL (5 polls listed as objects in the JSON by following the link, however I cannot figure out how to WORK with this.) For example, I would want to call polls[0].rank to populate a list of the top 25 teams from the poll.

Accessing the arrays of objects inside nested JSON has obviously been a problem for me in Node, and would love to get started on the right foot when working with this project. [1]: https://api.collegefootballdata.com/rankings?year=2019&week=1&seasonType=postseason

Accessing JSON objects nested inside array (Node.js)

This should be a simple fix but I can't find solutions anywhere for my specific problem. I've never worked with JSON before so bare with me, but I've been trying to access the JSON from [this API][1]. However, when I run a request to retrieve the JSON I'm met with the following list when I run this code.

const request = require('request');
var url = 'https://api.collegefootballdata.com/rankings?year=2019&week=10&seasonType=regular'
request(url,(err, res, body) => {
 if(!err && res.statusCode == 200) {
 var obj = JSON.parse(body);
 console.log(obj);
 }
});

My output:

[
 {
 season: 2019,
 seasonType: 'regular',
 week: 10,
 polls: [ [Object], [Object], [Object] ]
 }
]

My problem here lies in the fact that I want the information from each POLL (5 polls listed as objects in the JSON by following the link, however I cannot figure out how to WORK with this.) For example, I would want to call polls[0].rank to populate a list of the top 25 teams from the poll.

Accessing the arrays of objects inside nested JSON has obviously been a problem for me in Node, and would love to get started on the right foot when working with this project. [1]: https://api.collegefootballdata.com/rankings?year=2019&week=1&seasonType=postseason

Accessing JSON objects nested inside array

I've been trying to access the JSON from [this API][1]. However, when I run a request to retrieve the JSON I'm met with the following list when I run this code.

const request = require('request');
var url = 'https://api.collegefootballdata.com/rankings?year=2019&week=10&seasonType=regular'
request(url,(err, res, body) => {
 if(!err && res.statusCode == 200) {
 var obj = JSON.parse(body);
 console.log(obj);
 }
});

My output:

[
 {
 season: 2019,
 seasonType: 'regular',
 week: 10,
 polls: [ [Object], [Object], [Object] ]
 }
]

My problem here lies in the fact that I want the information from each POLL (5 polls listed as objects in the JSON by following the link, however I cannot figure out how to WORK with this.) For example, I would want to call polls[0].rank to populate a list of the top 25 teams from the poll.

Accessing the arrays of objects inside nested JSON has obviously been a problem for me in Node, and would love to get started on the right foot when working with this project. [1]: https://api.collegefootballdata.com/rankings?year=2019&week=1&seasonType=postseason

deleted 190 characters in body
Source Link
Andreas
  • 21.9k
  • 7
  • 52
  • 58

This should be a simple fix but I can't find solutions anywhere for my specific problem. I've never worked with JSON before so bare with me, but I've been trying to access the JSON from [this API][1]. However, when I run a request to retrieve the JSON I'm met with the following list when I run this code.

const request = require('request');
var url = 'https://api.collegefootballdata.com/rankings?year=2019&week=10&seasonType=regular'
request(url,(err, res, body) => {
 if(!err && res.statusCode == 200) {
 var obj = JSON.parse(body);
 console.log(obj);
 }
});

const request = require('request');
var url = 'https://api.collegefootballdata.com/rankings?year=2019&week=10&seasonType=regular'
request(url,(err, res, body) => {
 if(!err && res.statusCode == 200) {
 var obj = JSON.parse(body);
 console.log(obj);
 }
});

My output:

[
 {
 season: 2019,
 seasonType: 'regular',
 week: 10,
 polls: [ [Object], [Object], [Object] ]
 }
]

[
 {
 season: 2019,
 seasonType: 'regular',
 week: 10,
 polls: [ [Object], [Object], [Object] ]
 }
]

My problem here lies in the fact that I want the information from each POLL (5 polls listed as objects in the JSON by following the link, however I cannot figure out how to WORK with this.) For example, I would want to call polls[0].rank to populate a list of the top 25 teams from the poll.

Accessing the arrays of objects inside nested JSON has obviously been a problem for me in Node, and would love to get started on the right foot when working with this project. [1]: https://api.collegefootballdata.com/rankings?year=2019&week=1&seasonType=postseason

This should be a simple fix but I can't find solutions anywhere for my specific problem. I've never worked with JSON before so bare with me, but I've been trying to access the JSON from [this API][1]. However, when I run a request to retrieve the JSON I'm met with the following list when I run this code.

const request = require('request');
var url = 'https://api.collegefootballdata.com/rankings?year=2019&week=10&seasonType=regular'
request(url,(err, res, body) => {
 if(!err && res.statusCode == 200) {
 var obj = JSON.parse(body);
 console.log(obj);
 }
});

My output:

[
 {
 season: 2019,
 seasonType: 'regular',
 week: 10,
 polls: [ [Object], [Object], [Object] ]
 }
]

My problem here lies in the fact that I want the information from each POLL (5 polls listed as objects in the JSON by following the link, however I cannot figure out how to WORK with this.) For example, I would want to call polls[0].rank to populate a list of the top 25 teams from the poll.

Accessing the arrays of objects inside nested JSON has obviously been a problem for me in Node, and would love to get started on the right foot when working with this project. [1]: https://api.collegefootballdata.com/rankings?year=2019&week=1&seasonType=postseason

This should be a simple fix but I can't find solutions anywhere for my specific problem. I've never worked with JSON before so bare with me, but I've been trying to access the JSON from [this API][1]. However, when I run a request to retrieve the JSON I'm met with the following list when I run this code.

const request = require('request');
var url = 'https://api.collegefootballdata.com/rankings?year=2019&week=10&seasonType=regular'
request(url,(err, res, body) => {
 if(!err && res.statusCode == 200) {
 var obj = JSON.parse(body);
 console.log(obj);
 }
});

My output:

[
 {
 season: 2019,
 seasonType: 'regular',
 week: 10,
 polls: [ [Object], [Object], [Object] ]
 }
]

My problem here lies in the fact that I want the information from each POLL (5 polls listed as objects in the JSON by following the link, however I cannot figure out how to WORK with this.) For example, I would want to call polls[0].rank to populate a list of the top 25 teams from the poll.

Accessing the arrays of objects inside nested JSON has obviously been a problem for me in Node, and would love to get started on the right foot when working with this project. [1]: https://api.collegefootballdata.com/rankings?year=2019&week=1&seasonType=postseason

Source Link
Loading
lang-js

AltStyle によって変換されたページ (->オリジナル) /