Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Football data API

$
0
0

I am trying to get data from the football-data.org API. My code looks like this:

import java.net.*;

String Link = "http://api.football-data.org/v1/teams/66/";

void setup()
{
  String[] results = null;
  try
  {
    URL url= new URL(Link);
    URLConnection connection = url.openConnection();
    connection.setRequestProperty("X-Auth-Token","XXXXXXXXXXXXXXXXXXXXXXXXXXXX");
    connection.setRequestProperty("X-Response-Control","minified");

    results = loadStrings(connection.getInputStream());
  }
  catch (Exception e)
  {
    e.printStackTrace();
  }

  if (results != null)
  {
    for (int i=0; i<results.length; i++) { System.out.format(results[i]); }
  }
}

The data is being printed like this:

{"id":66,"name":"Manchester United FC","shortName":"ManU","squadMarketValue":"534,250,000 €","crestUrl":"http://upload.wikimedia.org/wikipedia/de/d/da/Manchester_United_FC.svg"}

but I want it like this:

{"id":66,

"name":"Manchester United FC",

"shortName":"ManU",

"squadMarketValue":"534,250,000€",

"crestUrl":"http://upload.wikimedia.org/wikipedia/de/d/da/Manchester_United_FC.svg"}

Can someone please help me? (I'm sorry, i'm new to processing)


Viewing all articles
Browse latest Browse all 2896

Trending Articles