Forum Discussion

dmorrow's avatar
dmorrow
Contributor
14 years ago

can the REST API return JSON objects?

Right now the REST API is documented as returning XML. Is there any support for returning the data as JSON? I like using JSON more than XML, and the payload size is smaller than XML, too.

 

Thanks for any info on this.

 

-Dan.

1 Reply

  • KaelaC's avatar
    KaelaC
    Lithium Alumni (Retired)
    14 years ago
    Yes, the REST API can return json instead of xml. Just put

    ?xslt=json.xsl

    at the end of your rest call. For example:
    http://lithosphere.lithium.com/restapi/vc/threads/recent?xslt=json.xsl

    You can also use ?xslt=json-v2.xsl instead. This will force all values to be returned in quotes. Useful if you have number strings that you don't want js to turn into numerical values.