[ Tutorials/FAQs/Samples/Basics for JSON ]
I am trying to create and parse JSON, and I get by with some samples found on Google/SO or trial-and-error. But I need some help with JSON basics, parsing, creating arrays inside JSON strings, and so on. I read about the JSONStringer and such, but I need information about parsing and creating complex JSON.
EDIT: I use Java.
First step typically is to look beyond bare-bones Java lib from org.json; other related questions therefore are, for example:
The reason for this is that there is no point in worrying too much about low-level details; rather you usually want to operate either with Java collections (List, Maps, wrapper types) or with basic Java objects. Other libraries can offer such abstractions.
My personal favorite is Jackson, and its tutorial is found here.
There isn't much to it. You got objects, arrays and primitives such as string, number, boolean and null. The syntax can be picked up by googling JSON.
The handling of JSON is more down to frameworks and server - are you translating a server side domain model to JSON? What server technology?
Client side pretty much any decent framework has helper methods for parsing JSON to get around certain browser differences (native JSON parsing being one). Check out jQuery.getJSON.
You can learn about JSON here.
In the Java side, you should actually not be writing/parsing JSON yourself. That's only a lot of tedious work and a waste of effort since there are plenty of libraries for this. Just pick a library which is able to convert a complex Java object to a JSON string (and vice versa) in a single call. This way you can concentrate on writing clean Java code, not on fiddling with JSON syntax in plain Java strings.