I've following as a String in Java. How to get only {"FirstName":"Deepak","LastName":"Kabra"}
value from below String using Java or Jackson? Please help
{"map_":{"FirstName":"Deepak","LastName":"Kabra"}}"
I've following as a String in Java. How to get only {"FirstName":"Deepak","LastName":"Kabra"}
value from below String using Java or Jackson? Please help
{"map_":{"FirstName":"Deepak","LastName":"Kabra"}}"
I recommend utilizing Jackson's TreeModel. If you use it and get the String into a JsonNode, then you can just use
jsonNode.get("map_")
and you'll have the string you want.
Edited with code example:
String jsonString = "{"map_":{"FirstName":"Deepak","LastName":"Kabra"}}";
ObjectMapper mapper = new ObjectMapper();
JsonNode obj = mapper.readTree(jsonString);
JsonNode desiredString = actualObj.get("map_");