Link to home
Start Free TrialLog in
Avatar of srikotesh
srikotesh

asked on

how to remove specific letters from string using java

Hi Experts,

the below line i am getting as a response from webservice call and its return type is string

"{"total":{"total":"0"},"result":{"p1":"0","p2":"0","p3":"0","p4":"0","p5":"0"}}"

the above value i am getting as a string
from that string
i have to display output as below
"{"total":"0","result":{"p1":"0","p2":"0","p3":"0","p4":"0","p5":"0"}}"

i have to remove "total": and { } braces
how to do

some times total might have a value
example:
"{"total":{"total":"213"},"result":{"p1":"0","p2":"0","p3":"0","p4":"0","p5":"0"}}"
"{"total":{"total":"1"},"result":{"p1":"0","p2":"0","p3":"0","p4":"0","p5":"0"}}"

can some one suggest how do i remove it.

if it is confusing with quotation provide solution with out using quotation
"{total:{total:1},result:{p1:0,p2:0,p3:0,p4:0,p5:0}}"
expected o/p:
"{total:100,result:{p1:0,p2:0,p3:0,p4:0,p5:0}}"
ASKER CERTIFIED SOLUTION
Avatar of gurpsbassi
gurpsbassi
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of mccarl
mccarl
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of srikotesh
srikotesh

ASKER

thanks for valuable suggestion.
GOOD