How to extract certain data from a response

Hi, I'm a begginer working with Android and I don't know how to extract some strings of the JSON object from the response. I want to extract all the definitions of a word to show them in a List.

Comments

  • SimoneSimone Administrator admin

    Hi @Aupuma
    Oh, let me get a colleague who will be able to help you - bear with me!

    In the meantime, you might find this video useful - it's from our first API webinar and it covers some of the basics on how to use it:
    Make the most of the Oxford Dictionaries API

  • AmosDuveenAmosDuveen Member, Administrator, Moderator admin

    Hi @Aupuma,

    Can you please clarify whether you want to know how to put together a URL for your call, or whether you want to know how to use the data you get out of our API?

    If it's the former, I would refer you to our documentation page where you can see all the endpoints and experiment with the available filters. It automatically generates a request URL that you can use as long as you remember to change the hostname (the documentation page is actually a parallel system, for security reasons).

    If it's the latter, it's not something we generally support but one of my colleagues may be able to assist you.

  • AupumaAupuma Member

    Our problem is about getting the definitions of a word extracting them of a JSON object. We don't know how to iterate the object as there are multiple nested arrays and is a bit complex for us.

  • vantipinvantipin Member

    Hi @Aupuma,

    Knowing how to iterate through JSON seems like a very general problem when working with any JSON providing API.
    You can easily find the examples on how to do this online.
    https://stackoverflow.com/questions/13573913/android-jsonobject-how-can-i-loop-through-a-flat-json-object-to-get-each-key-a

    Start accessing and checking keys for validity from the top and continue unless you get to definition key.

  • abasuabasu Member
    edited June 2017

    Hi @Aupuma,

    In addition to what @vantipin says, I'd like to add that I often find it useful to look at JSON with a parser, for example, this online parsor jsoneditoronline.org/. It shows you an indented tree, with the lists and dictionaries, and with their keys and indexes.

    For example, here's a picture of an expanded tree:

Sign In or Register to comment.