Page tree
Skip to end of metadata
Go to start of metadata



How I parse json key for a json value in java, and perform action on specific value.

Select a JSON value from a JSON post body (i.e. payload , post data ) and act on specific json value


public static void read(String incomingJSONPostBody) {

        JsonReader reader = Json.createReader(new StringReader(incomingJSONPostBody));

        JsonObject jsonobject = reader.readObject();

        JsonString jsonValue = jsonobject.getJsonString("jsonKey");


        if (jsonValue.toString().contains("matcher")) {

           //perform action if matcher

            String specificValue = jsonValue.toString();

            System.out.println(specificValue);

        }

    }



using javax.json

Store Objects made with Json.createObjectBuilder into jsonArrayBuilder... example:

jsonFirstObject = Json.createObjectBuilder()

.add("name", 

  • No labels
Write a comment…