I looked in the Yahoo! Messenger API documentation to see how can I get the access token and I found this:
The call looks like this:
https://login.yahoo.com/WSLogin/V1/get_auth_token?&login=username&passwd=mypassword&oauth_consumer_key=consumerkeyThe result of this call is a single value, the
RequestToken:
RequestToken=jUO3Qolu3AYGU1KtB9vUbxlnzfIiFRLP...This token is then used for a second request, which exchanges the PART for an OAuth access token. You can find out more information on the standard method getting an access token here.
I guess that the result is a standard result, but I don't know what kind of data is this. I mean that it isn't XML or JSON.
I would like to convert such a string to JSON:
{
RequestToken: "jU0..."
}
Is there any standard converter/parser or must I build one?
Also, another request can look like below:
Error=MissingParameters
ErrorDescription=Sorry, try again with all the required parameters.
and I want to convert it into JSON:
{
Error: "MissingParameters",
ErrorDescription: "Sorry, try again with all the required parameters."
}
It would be very easy to build such a parser, but I don't want to reinvent the wheel.
I decided to write my own function. If there is a standard algorithm to parse such a string leave a comment.