JSON-java icon indicating copy to clipboard operation
JSON-java copied to clipboard

Where is the API documentation?

Open petercwallis opened this issue 5 years ago • 10 comments

  • in the code no doubt. But I just spent half an hour not finding how to get a named string attribute from a JSONObject... A 'getting started' entry about how easy it is to use this package would not go astray. P

petercwallis avatar Oct 02 '20 03:10 petercwallis

That's on me, there have been other requests for API docs, JavaDocs, etc, but time has not permitted. As luck would have it, I expect to have some cycles available soon, and I love to write documentation, so stay tuned...

In the meanwhile, if you have not already found it, try:

jsonObject.getString("myStringKey");

Caveat: This will throw an exception if the key is not found, or if the value is not a string. When unsure, try this, which will return an empty string if not found:

jsonObject.optString("myStringKey");

stleary avatar Oct 02 '20 03:10 stleary

Hello @stleary

I have been an active user of this project for over an year and would want this open-source project to live on. I am actively converting instances of net.sf.json and net.minidev.json usages in our projects at work into (guess what?) org.json exclusively and have documented changes to API calls and challenges observed.

I have been on the lookout to be able to contribute here for a long time and this seems like an opportunity.

  1. For a start, where do I start rewriting my said list of observations? README.md or docs/
  2. On another note, I suppose the existing documentation site currently serves content from gh-pages branch. Isn't that "The API documentation" being asked for here?

fossterer avatar Oct 05 '20 14:10 fossterer

Yes the existing documentation site would have done me! (I just looked at the source code and solved it in 5 minutes but)

A getting started example at the top of the project page for the newbies (with JSONObject.get(String) and put(..)) and a link to that page is all that is needed.

p

On Mon, 5 Oct 2020 at 15:21, Shashank Sabniveesu [email protected] wrote:

Hello @stleary https://github.com/stleary

I have been an active user of this project for over an year and would want this open-source project to live on. I am actively converting instances of net.sf.json and net.minidev.json usages in our projects at work into (guess what?) org.json exclusively and have documented changes to API calls and challenges observed.

I have been on the lookout to be able to contribute here for a long time and this seems like an opportunity.

  1. For a start, where do I start rewriting my said list of observations? README.md or docs/
  2. On another note, I suppose the existing documentation site http://stleary.github.io/JSON-java/ currently serves content from gh-pages branch https://github.com/stleary/JSON-java/tree/gh-pages. Isn't that "The API documentation" being asked for here?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/stleary/JSON-java/issues/566#issuecomment-703664431, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALY3LWJ33QS6L3TQWEA52MDSJHI53ANCNFSM4SBGDP5Q .

petercwallis avatar Oct 05 '20 14:10 petercwallis

The JavaDocs are good for reference, but not as helpful for learning. The readme should have a link to a Getting Started or Quick Start guide in the wiki. The front page of the wiki has a little text on this subject but it was never completed.

stleary avatar Oct 06 '20 15:10 stleary

I can't find any document or example about convert json data to object

alien142 avatar Dec 24 '20 08:12 alien142

All of my free time to write docs evaporated soon after the Oct posts. Will try to put something together this weekend.

stleary avatar Dec 24 '20 20:12 stleary

Hi, I need the documentation for a research project, where can I find it?

xiscomigueles avatar Mar 30 '21 11:03 xiscomigueles

Please check here: http://stleary.github.io/JSON-java/index.html. If you need some other type of documentation that is not in the Readme or one of the wiki pages, let me know and I will see what I can do.

stleary avatar Mar 31 '21 02:03 stleary

I have made a simple Java file in which i explain how to get started with all the JSON-types and how to use all conversors to new-comers. Would it be interesting enough to upload it to GitHub and request a merge?

TheNeoStormZ avatar Apr 01 '21 11:04 TheNeoStormZ

@TheNeoStormZ It is OK to submit a pull request. Normally this information would appear in the readme or a wiki page. If the content is helpful, we can find a place to put it.

stleary avatar Apr 02 '21 05:04 stleary

Closing due to docs available online. If you still think there is a gap, post here and the issue will be reopened.

stleary avatar Sep 03 '23 15:09 stleary