A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Java
»
Java in General
Author
Extract value from String
Angus Ferguson
Ranch Hand
Joined: Jun 22, 2012
Posts: 240
posted
Sep 12, 2012 04:06:46
0
Hi I have make a request to the server and I have got the next answer
access_token" : "xxxxxxxxxxxxxx, "token_type" : "Bearer", "expires_in" : 3600, "id_token" : "xxxxxx"
Now from my code I need extract the value of the access_token, I have this code:
String res= this.sendRequest(code);
where res is a
string
with the data. What way could I have only the access_token?
Many Thanks
R. Jain
Ranch Hand
Joined: Aug 11, 2012
Posts: 276
I like...
posted
Sep 12, 2012 04:33:45
0
Angus Ferguson wrote:
What way could I have only the access_token?
Many Thanks
You can use
split
method of
String
class. That would be helpful..
OCPJP
Matthew Brown
Bartender
Joined: Apr 06, 2010
Posts: 3786
1
I like...
posted
Sep 12, 2012 04:42:52
0
Is that response JSON? It looks like it. If it is, the easiest way of parsing it is going to be to use a JSON library.
I agree. Here's the link:
http://zeroturnaround.com/jrebel/download
subject: Extract value from String
Similar Threads
Sending http request
commons fileupload mutlipart/data-form, extracting values from the checkboxes
A 404 Error, need help configuring web.xml
Sending http request
RestFB Insights question
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter