Parsing json data returned from Bing API search in java


  • I'm having an issue parsing the json data from the bing search API.  I'm trying to get the Description field but keep getting null as the value.  

    in my url i'm using &$format=json 

    Here's what is returned so Description is in the results - 

    {"d":{"results":[{"__metadata":{"uri":"\u0027xbox\u0027&$skip=0&$top=1","type":"WebResult"},"ID":"95566dcf-9477-4000-a391-ecd6b9e8c3ec","Title":"Xbox -","Description":"Visit for information about Xbox One, Xbox 360, Xbox Live, games, TV, movies, music, sports and more.","DisplayUrl":"","Url":""},{"__metadata":{"uri":"\u0027xbox\u0027&$skip=1&$top=1","type":"WebResult"},"ID":"3460830a-c819-42dd-9cb0-f23c73b982e3","Title":"Xbox - Wikipedia, the free encyclopedia","Description":"The Xbox is a video gaming brand created by Microsoft. It includes a series of video game consoles developed by Microsoft, with consoles in the sixth to ...","DisplayUrl":"","Url":""}],"__next":"\u0027xbox\u0027&$skip=2&$top=2"}}

    Code below:

    result contains the json data  returned from the Bing api.  

    String jString = result.getString("Description").toString();

    Should the string search be something different to return "Description" or do I have to do something more complex to parse json?  

    thanks for the help they have so few examples on here working with this api and java.

    Wednesday, July 17, 2013 12:42 PM


All replies