jamsesso / json-logic-java

A pure Java implementation of JsonLogic without using the Nashorn JS engine
MIT License
99 stars 50 forks source link

Question: Add ability to parse JsonElement directly. #26

Closed cr-kobyisrael closed 2 years ago

cr-kobyisrael commented 2 years ago

Currently the only public method for parsing is with String, is there any reason why direct use of JsonElement is private and not public ? see: https://github.com/jamsesso/json-logic-java/blob/master/src/main/java/io/github/jamsesso/jsonlogic/ast/JsonLogicParser.java#L25

jamsesso commented 2 years ago

It's private because the representation of JSON internally uses GSON, but that is far from the most popular way of doing it. Making this public would prevent the library from changing it's underlying representation of JSON without a major breaking change for consumers.

However, I understand the desire to avoid using a string representation of JSON all of the time... maybe there is a better solution that avoids coupling to GSON but also allows us to avoid allocating strings to parse for larger JsonLogic programs.