This question has already been answered:
- How and what to parse Json in Java? 4 replies
I have an array in json that looks like this:
contacts:[ { "contact_id": 1 }, { "contact_id": 2 } ] I take out the whole thing like this:
public void doPost(HttpServletRequest requestObject, HttpServletResponse responseObject) throws ServletException, IOException { JsonObject requestJson = getJsonContent(requestObject); JsonArray contactsArray=requestJson.getAsJsonArray("contacts"); But I just can’t figure out how I can get all the values of all contact_id variables so that I can search the database for each of them.