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

Posts: 51
Registered: ‎09-18-2008
My Device: Not Specified

how to parse ,


hi all,

please go through the below response formate,which i need to parse,please help me how to parse ,i am new to this kind for parse.sorry i am distrubing you.

its very urgent please send me the link or sample code.


{"loan_amount":"<loan amount>","repay_amount":"<repay amount>",”loan_type”:”<Loan Type>”,"person_id":"<person id>","password":"<password>"}

The response is loan request Id in text/text mime type.


Thanks in advance.

Posts: 216
Registered: ‎09-11-2008
My Device: 9000(Bold)

Re: how to parse ,

Hi, That looks like a Json xml and so you'll need Json parser.

Try this link: 



Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: how to parse ,



Have a look at this class net.rim.device.api.util.StringUtilities


This class contains function like stringToKeywords(String string)


which will parse your string according to the delimiter you provided.This function returns a String[].



Rajat Gupta.

Rajat Gupta.
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: how to parse ,

This is probably a simpler choice than XML for BW and CPU but you may want to consider also

tokenizing or compressing the file on the server. For example, instead of sending a word, send an

index from a shared dictionary. If you find that you need to use a lot of time "doing something" on your

phone, sometimes parsing can add up, you may want to find ways to do that on server before picking

an over-the-air format. You may get to the point where you don't really parse anything and just have something like

a set of index-value pairs and can fill up an array with a small loop. All references to variables then require

an extra step of dealing with indicies but the overall code may not suffer. For example,

static final int GROSS_AMOUNT=3;

static final int DEDUCTS=4;


int netAmount=data[GROSS_AMOUNT]-data[DEDUCTS];


AFAIK the compiler should be able to treat the index as a constant ( generate something like data[3] )

Depending on how you use the data, this may or may not be a good idea but it is about the opposite of most

code generated by things like JAXB or the WSDL code generators. Using this approach, you may end up with object that have only one member, and array, and two methods for get/set ( that take an index parameter instead of being named for a member variable) a given element or maybe array versions of these too.

The ability to do block moves may or may not help depending no the data. Instead of 50 assignments

a.foo=b.foo; a.blah=b.blah etc, you can make tables of indicies for stuff like this etc etc.


Just something to consider once you have given up XML there are a lot of options.