Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Sample Code - Implementing JSON in your application

by Retired on ‎07-30-2010 09:37 AM - edited on ‎09-20-2010 05:01 PM by Retired (12,223 Views)

JavaScript Object Notation (JSON) is a lightweight, low overhead, method of describing objects. This notation can be extremely useful when implemented as an alternative to web services though does typically require a bit more coding to handle how the custom data types are converted to and from JSON format. However, as this is controlled by code and JSON handles most primitive data types that are common among programming languages, it can also be used as a communication medium between systems and applications built on different programming languages. Libraries for various languages have already been created and are ready to implement. For more information on these please refer to the JSON home page. This site also contains lots of background information about JSON and some source code.


The sample attached below shows a basic cake ordering system that helps construct a CakeObject that it then converted into a JSON String. This example will help familiarize you with the steps required to implement JSON in your own application as well as determine the benefit of its use and the way different data types are formatted once converted to JSON. It contains two projects, the application and the JSON ME library source code. These will need to be set up so that the application depends on the library in order to compile and test.

Users Online
Currently online: 27 members 1,882 guests
Please welcome our newest community members: