I need to get a json string, that is part of a larger json. As a simplified example, I want to extract only file01, and I need the json object as a string.
{
"file01": {
"id": "0001"
},
"file02": {
"id": "0002"
}
}
So, in code something like:
String file01 = JsonPath.parse(jsonFile).read("$.file01").toJson();
System.out.println(file01); // {"id":"0001"}
I would like to use the library JsonPath, but I do not know how to get what I need.
Any help is appreciated. Thanks!
JsonPath?