Any suggestions for getting the JPATH's for the input JSON file. Basically a tree structure of the JSON schema from the JSON file
Asked
Active
Viewed 244 times
0
-
1Had a similare use case. I used Map.class, typically Map
– pranav prashant Jan 20 '20 at 12:58 -
I do not have an Object to get the schema. Its just the JSON file from which we need to get the schema – Sandeep Shetty Jan 21 '20 at 11:03
1 Answers
0
You should be okay to use JsonParser
this way;
First, get the JSON file content as a String. (Say jsonString
)
Then code something like this;
JsonParser parser = new JsonParser();
JsonObject o = parser.parse(jsonString).getAsJsonObject();
Once you have the JSON Object, you can use the JsonPath library to get what you may need.
Hope this helps!
![](../../users/profiles/11226302.webp)
Shivam Puri
- 915
- 7
- 20