title: How to count number of elements from JSON using java
body: <p>I am pretty new to java and rest. I was trying to count elements from the <code>item</code> object using rest. If you check below Json then you will find 6 elements associated with the item object.   </p>
  
  <pre><code>{
    "response": {
      "status": "active",
  
      "timestamp": "2019-01-02 20:07:42"
    },
  
    "group": [
      {
  
        "best_option": "Offer",
        "item": {
          "F": [
            {
              "code": "228"
            }
          ],
          "E": [
            {
              "code": "228"
            }
          ]
        },
        "review": {
          "F": [
            {
              "code": "110"
            },
            {
              "code": "212"
            }
          ],
          "E": [
            {
              "code": "110"
            },
            {
              "code": "212"
            }
          ]
        }
      },
      {
        "best_option": "Offer",
        "item": {
          "D": [
            {
              "code": "228"
            }
          ],
          "C": [
            {
              "code": "228"
            }
          ]
        },
        "review": {
          "D": [
            {
              "code": "110"
            },
            {
              "code": "212"
            }
          ],
          "C": [
            {
              "code": "110"
            },
            {
              "code": "212"
            },
            {
              "code": ""
            }
          ]
        }
      },
      {
        "best_option": "Offer",
        "item": {
          "A": [
            {
              "code": "228"
            }
          ]
        },
        "review": {
          "A": [
            {
              "code": "110"
            },
            {
              "code": "212"
            }
          ]
        }
      },
      {
  
        "best_option": "Offer",
        "item": {
          "B": [
            {
              "code": "228"
            },
            {
              "code": "662"
            }
          ]
        },
        "review": {
          "B": [
            {
              "code": "110"
  
            },
            {
              "code": "662"
            }
          ]
        }
      }
    ]
  }
  </code></pre>
  
  <p>I have tried <code>jsonResponse.getBody().jsonPath().get()</code> to count element from item object. I want to count number of elements present in the item object for e.g: A, B, C,D,E F . Can someone please help me to sort out my issue?</p>