cancel
Showing results for 
Search instead for 
Did you mean: 

Re:Extending JAM Application

Former Member
0 Kudos

Hi,

    I was successful in creating JAM extension Using HCP with the great help of Robert, Adam and James. Now im trying to change the format of the output that we get in JSON format. This output will contain number of data displayed on the screen whenever some function is performed. Here my question is, is that possible to get only some important data from the JSON file.

For example: When the new Group is created by giving the Group name using createGroup functionality we get the following JSON file as output indicating that particular group is created in JAM.

{

d:

{

results:

{

_metadata{

uri:

type:

},

id:

description:

...

...

...

}

Here can we get just the Group name, Group ID and Created By as the output. Can anyone please help me out in this.

Many Thanks & Regards,

Soumya

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Could anyone please help me out in this issue, whatever i'm trying to change the .jsp code to fetch the separate values from the JSON output, i'm getting class compilation error.

Thanks in advance,

Soumya

Adam_Stone
Active Contributor
0 Kudos

Hi Soumya,

This should be either string parsing or using a third party library that can help parse JSON strings.  How are you trying to pull these values out?  What is the class compilation error that you are getting?

-Adam

Former Member
0 Kudos

Attached is the error im facing while execution.

I have added a for loop in the .jsp file as below:

if( responseEntity != null)

{

String responseString = EntityUtils.toString(responseEntity);

for(int i=0; i<responseString.length; i++)

{

out.println(responseString);

}

}

i wanted to fetch the particular values from responseString. So i thought if im getting separate values using for loop from there i can fetch the needed values.

But nothing worked, whatever code i change im getting the same compile error.

Can u pls suggest me with some other code where the particular values can be fetched.

Regards,

Soumya

Adam_Stone
Active Contributor
0 Kudos

You have a syntax error on this line:
for(int i=0; i<responseString.length; i++)

It should be:

for(int i=0; i<responseString.length(); i++)

Generally speaking, if you are getting a compiler error, you want to go into the application server logs, in this case since you are using HCP as your application server, you can go into the Java application properties in HCP and there is a log section that you can download the logs from to review.  These logs will give you more details around what the actual error is.