Parsing a common Internet data format
You can configure a
Destination object to return a
Java® object that contains
data parsed from a standard format, such as JSON. To retrieve the data
structure in a
Java object, you should:
Code sample
The following code sample demonstrates the three actions that are required to retrieve a Java object that contains a JSON data structure.
import net.rim.device.api.io.messaging.*
import net.rim.device.api.io.parser.json.*
// Specify a MessageProcessor when you create your Destination
BlockingSenderDestination bsd = DestinationFactory(myContext, myURI,
new JSONMessageProcessor());
// Retrieve the response
Message response = bsd.sendReceive();
// Extract the Java object that contains the JSON data structure
Object payload = response.getObjectPayload();
Next topic: Subscribing to a push initiator
Previous topic: Send data using a FireAndForgetDestination object