Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any configuration available to speed up Flatten and Unflatten JSON? #82

Open
vsachinv opened this issue Jun 8, 2023 · 1 comment

Comments

@vsachinv
Copy link

vsachinv commented Jun 8, 2023

We have pretty big JSON files which contains sometimes more than 180k nodes as well. We have done comparision with https://github.com/spring-projects/spring-vault/blob/main/spring-vault-core/src/main/java/org/springframework/vault/support/JsonMapFlattener.java api and found JSONFlattern is almost taking 5 times time. Is there any config available to speed up the same which can be tweaked and also Unfllatten is also taking alot time even after applying latest build.

@wnameless
Copy link
Owner

There is a main difference between json-flattener and Spring JsonMapFlattener. Spring JsonMapFlattener processes Java Map directly, but json-flattener does JSON processing at first. This difference results in performance comparison.

However json-flattener adopts json-base as implementation interfaces which supports org.json natively, therefore add org.json into your dependencies, then you can do something like this:

JsonFlattener jf = new JsonFlattener(new OrgJsonValue(new JSONObject(map)));

Because org.json uses most Java native objects internally, this approach should increase the performance you wish to gain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants