I am working on a Java Spring Boot application. I have a Json in the following format. I need to search for a string and return the results in the same json format containing only the matching entries.
The original json is as below:
{
"version": "1.0.2",
"students": ["John Smith", "John Green", "Martin King"],
"teachers": ["John Lord", "Martin Evans", "Steve John", "Gordon Lee", "Leo Martin"],
"authors" : ["Martin Fowler", "Erich Gamma"]
}
For example, if I search for the string “mart”, it should return the json below:
{
"version": "1.0.2",
"students": ["Martin King"],
"teachers": ["Martin Evans", "Leo Martin"],
"authors" : ["Martin Fowler]
}
How can I do this efficiently? Thank you.