1

So I have following link which contains a lot of data (a lot). http://www.gw2spidy.com/api/v0.9/json/all-items/all

The data is a list of ~50,000 sets of data, separated by commas.
Is there anyway I can convert this some 50,000 entries of data to an array?

Here is one entry of data for reference.

{
  "data_id":2,
  "name":"Assassin Pill",
  "rarity":1,
  "restriction_level":0,
  "img":"https:\/\/render.guildwars2.com\/file\/ED903431B97968C79AEC7FB21535FC015DBB0BBA\/60981.png",
  "type_id":3,
  "sub_type_id":1,
  "price_last_changed":"2014-05-10 20:00:13 UTC",
  "max_offer_unit_price":0,
  "min_sale_unit_price":0,
  "offer_availability":0,
  "sale_availability":0,
  "sale_price_change_last_hour":0,
  "offer_price_change_last_hour":0
}

1 Answer 1

1

It is JSON data, Use

$yourarray = json_decode(file_get_contents('http://www.gw2spidy.com/api/v0.9/json/all-items/all'),true);

to convert them into an array.

Sign up to request clarification or add additional context in comments.

2 Comments

And you would just use echo $yourarray[0]; for first result, and etc?
If the array has user-defined keys, then you can't access that way.. Access them using the defined keys like this.. eval.in/149297

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.