Forum Discussion
Hi Qing,
It is possible to get the response as a JSON object. To do so, you will want to append the following query string paramter to your request:
xslt=json.xsl
For example, to get the JSON object for a message you can use the following call:
http://<your community url>/<your community id>/restapi/vc/messages/id/2776?xslt=json.xsl
I hope this helps!
- qinglau14 years agoMentor
Hi AdamN,
That is awesome new for you. Today, i tried really hard to use Javascript covert XML2Array or XML2JSON, Not much luck.
Am I right here?
So, in my community URL for fedrated search is from XML
http://discussions.tomtom.com/tomtom/restapi/vc/search/messages?phrase=map&page_size=10&restapi.response_style=view
to JSON will be:
discussions.tomtom.com//tomtom/restapi/vc/search/messages?phrase=map&page_size=10&xslt=json.xsl- KaelaC14 years agoLithium Alumni (Retired)
That looks right. Here is an example from Lithosphere using your code:
http://lithosphere.lithium.com/restapi/vc/search/messages?phrase=map&page_size=10&xslt=json.xsl
- qinglau14 years agoMentor
Hello Guys,
Thanks all the help so far. We have kind of prove of concept of Federated search in RightNow page.In order to complete the Function, I would like to know the return JSON object length. Does Lithium has a standard way to get "length" of JSON object, or i have to create a Function by myself, like:
Function countProperties(obj) { var prop; var propCount = 0; for (prop in obj) { propCount++; } return propCount; }
Thanks.
Related Content
- 12 years ago