Skip to content

venuesSearch giving JSONParsingException. Icon is of type String in Category while it should be a class. #81

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?
1. Call venuesSearch with ll="18.5203,73.8567"
2. Result<VenuesSearchResult> result = foursquareApi.venuesSearch(ll, null, 
null, null, null, null, null, null, null, null, null);
3.

What is the expected output? What do you see instead?
Expected output is Result<VenuesSearchResult>, but I get exception since the 
Category class has field icon as String but in JSON response, it is a nested 
field as: 

 "categories": [
        {
            "id": "4bf58dd8d48988d171941735",
            "icon": {
                "prefix": "https://ss1.4sqi.net/img/categories_v2/building/eventspace_",
                "suffix": ".png"
            },
            "primary": true,
            "name": "Event Space",
            "shortName": "Event Space",
            "pluralName": "Event Spaces"
        }
    ],

So when we try to parse it, I get exception as: org.json.JSONException: 
JSONObject["icon"] not a string.

Content of Category class:
 private String id;
  private String name;
  private String pluralName;
//************************
  This is a String but in response, it is nested structure.
  private String icon;
//***************************
  private String[] parents;
  private Boolean primary;
  private Category[] categories;


What version of the product are you using? On what operating system?
I am using foursquare-api-1.0.2.jar

Please provide any additional information below.
I think we need to add a class Icon with two String fields prefix and suffix. I 
really wonder how it is working for anyone.

Original issue reported on code.google.com by sujitjaj...@gmail.com on 9 Jul 2014 at 7:19

Attachments:

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions