Loading ...
Sorry, an error occurred while loading the content.

8832Inconsistent return from flickr.blogs.getList

Expand Messages
  • Jeremy Brooks
    Jun 7, 2014
    • 0 Attachment

      I am using gson to parse the JSON return from Flickr into Java classes. However, I have found a case where the returned data breaks the parsing. If a user has blogs defined, the return looks like this:
      { "blogs": { 
          "blog": [
            { "id": "72157594526571385", "name": "Jeremy Brooks", "service": "MetaWeblogAPI", "needspassword": 1, "url": "http:\/\/www.whirljack.net\/jeremybrooks\/" },
            { "id": "72157624726446757", "name": "Twitter: Jeremy Brooks", "service": "Twitter", "needspassword": 0, "url": "http:\/\/twitter.com\/jeremybrooks" }
          ] }, "stat": "ok" }
      However, if the user has no blogs, the return is this:
      { "blogs": [
        ], "stat": "ok" }

      In the first case, an array of blog classes inside a blogs class is returned; in the second case, an empty array in the blogs class is returned. Would it be possible to return something like this, to indicate an empty array of blog classes? The structure would then be consistent, and the parser would work as expected.
      { "blogs": { 
          "blog": [
            ] }, "stat": "ok" }