jnharton / j-gw2-api

Guild Wars 2 API Wrapper
0 stars 0 forks source link

event_name.json, map_names.json, and world_names.json issue #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
How to reproduce the issue : 
1. Create a new class : 

import org.json.JSONObject;

import jGW2API.jGW2API;

public class MapExemple {
  public static void main(String[] args) {
    JSONObject worldNames = jGW2API.getWorldNames();
  }
}

2. Execute code. 
3. Get the following exception : 
A JSONObject text must begin with '{' at character 1
    at org.json.JSONTokener.syntaxError(JSONTokener.java:410)
    at org.json.JSONObject.<init>(JSONObject.java:179)
    at org.json.JSONObject.<init>(JSONObject.java:402)
    at jGW2API.jGW2API.getJSONObject(jGW2API.java:149)
    at jGW2API.jGW2API.getWorldNames(jGW2API.java:283)
    at MapExemple.main(MapExemple.java:9)

What is the expected output? What do you see instead?

The JSON text given by ArenaNet seem to not be a well formatted JSON. 

The files event_name.json, map_names.json, and world_names.json begin with a 
"[" instead of a "{".

Original issue reported on code.google.com by Giry.Geo...@gmail.com on 22 May 2013 at 9:59

GoogleCodeExporter commented 8 years ago
Yeah, this is my fault.
I was under the impression that everything would be JSONObjects, but 
event_names, map_names and world_names are actually JSON array.

Will be fixed soon.

Original comment by Varonth87 on 22 May 2013 at 11:42

GoogleCodeExporter commented 8 years ago
Should be fixed now. Please keep in mind, that those functions now return 
JSONArray instead of JSONObject.

Also added a getJSONArray method if you aren't using the static methods.

Original comment by Varonth87 on 22 May 2013 at 11:58

GoogleCodeExporter commented 8 years ago
Working fine now.

Thanks !

Original comment by Giry.Geo...@gmail.com on 23 May 2013 at 4:20