hub4j / github-api

Java API for GitHub
https://github-api.kohsuke.org/
MIT License
1.12k stars 718 forks source link

Add serialization JSON output #1035

Open bitwiseman opened 3 years ago

bitwiseman commented 3 years ago

Several users have filed issues around serializing objects to JSON: #1034, #971.

Consider adding a toJSON() method to objects, readRawJSON() method to GitHub, or documenting a supported way to do this using the existing ObjectMapper returning methods.

l3ender commented 4 months ago

I arrived here with a similar need/ask as described in https://github.com/hub4j/github-api/issues/235. We want to leverage this library for its handling of the GitHub API complexities (authentication, paging, rate limiting, etc), but are interested in getting the raw JSON data--as returned from the API--in order to save/process it separately, without needing to worry about regularly checking/updating library in case of new API additions.

I know this and related issues are a few years old, but any thoughts/ideas of how to accomplish it?

FWIW, in other parts of our application(s), we do use (and love) this library for its OO approach and simplification of the API. Thank you!

bitwiseman commented 4 months ago

@l3ender This issue is about serializing GH* instances to JSON and creating usable GH* instances from raw JSON provided by the user.
GH*.toJSON() output would be limited to the fields on the class, not the same as the raw JSON returned from GitHub.

I think what you're asking for is closer to #513 (and adding a fetchJSONString()). Maybe also adjacent to #1232.

Please open a new issue and include details about your scenarios in there - examples of what you want to do and what advantages the raw JSON has in that scenario(s).