You are not signed in. Log in or Register

API bug

3 post(s), 2 voice(s)

Hello,

While trying to make a web page using the z33k API, I discovered that the JSON syntax seems to be incorrect on certain items. Such as the code posted here:

http://pastebin.com/98Q0jbqM

I may be mistaken but it seems to only be on the tournaments part of the API in most of the places there needs to be a [ and a {.

Thanks,
Derek “PuzzledPlane”

Lux 569 post(s)

Hey puzzledplane,

Thanks for the report. In JSON square brackets [] denote an array, whereas curly braces {} denote key value pairs, sometimes called a hash or set or dictionary. Here is a short example of how you might access the values.

The places we use key value pairs instead of arrays is by design, and it should pass JSONLint test: https://gist.github.com/1758101. In the case you posted the order of the attributes, such as “players_checked_in” or “short_url” do not matter, and it is easier to access by name

result[“tournament”][“players_checked_in”]

if it were in an array, let’s say the way you had posted it, it would be accessed like this:

result[“tournament”][ 2]

Let me know if you have any other questions or feature requests for the API.
Thanks,
Lane

Hmm interesting. Now I just need to figure out how to query the tournaments part of the array to pull that info in PHP. Sorry for the seemingly wrong report now.

Thanks,
Derek “Puzzledplane”