0

Any suggestions for getting the JPATH's for the input JSON file. Basically a tree structure of the JSON schema from the JSON file

Sandeep Shetty
  • 167
  • 2
  • 12

2 Answers2

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!

Shivam Puri
  • 1,578
  • 12
  • 25
0

try https://github.com/saasquatch/json-schema-inferrer

Json file or string to JsonNode, then

JsonSchemaInferrer.newBuilder()
  .setSpecVersion(SpecVersion.DRAFT_06).build()
  .inferForSample(jsonNode)
Dmitry
  • 557
  • 5
  • 12