Able to reach only parent element of JSON

Viewed 22

I am trying to parse Json response using kong.unirest classes.

It's response from Ebay API search request. I am interested in de-serializing "item" objects

json goes like this:

{
  "findItemsByKeywordsResponse": [
    {
      "ack": [
        "Success"
      ],
      "version": [
        "1.13.0"
      ],
      "timestamp": [
        "2022-09-16T14:25:37.200Z"
      ],
      "searchResult": [
        {
          "@count": "25",
          "item": [
            {
              "itemId": [
                "125307311739"
              ],
              "title": [
                "Sega Genesis VIDEO GAMES - Sega Genesis - CREATE YOUR BUNDLE - LOT - "
              ],
              "globalId": [
                "EBAY-US"
              ],
              "primaryCategory": [
                {
                  "categoryId": [
                    "139973"

I am interested in item objects.

"item":

but I cannot get to item array, trying jsonResponse.getBody().getArray().toList() - getting list of size 1. - "findItemsByKeywordsResponse" object

using jsonResponse.getBody().getObject().getString("") still only able to find "findItemsByKeywordsResponse" and no any other element.

I also tried using Jackson lib JsonNode node = mapper.valueToTree(fromValue);, but still the problem is I am not able to reach anything but parent element.

I do understand I am missing some very basic thing. Please advice.

0 Answers
Related