×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Nokia Developer Expert
    Join Date
    Mar 2010
    Posts
    6

    How to get plain JSON respponse

    Is there a flag in the Places API request to get plain JSON response (without any presentation UI & styling) to be viewed on a web browser ?

    Thanks,
    Venkat

  2. #2
    Registered User
    Join Date
    Feb 2012
    Location
    Mexico
    Posts
    7

    Re: How to get plain JSON respponse

    Hi, the response is a JSON string, to load the response in the DOM you must to execute the request via XMLHTTPRequest( AJAX ) and load the response via JavaScript.

  3. #3
    Nokia Developer Expert
    Join Date
    Apr 2012
    Posts
    4

    Re: How to get plain JSON respponse

    Places API honors the HTTP header Accept. As browsers usually send something like "text/html", you receive a beautified, interactive HTML representation of the JSON response when you type a Places API request URI in a browser. The only exception of this rule is the JSONP support: Whenever make use of the JSONP callback parameter, Places API will ignore any Accept header and return the JSONP call code.

    If you want the bare-bone JSON representation in the browser you have two alternatives:
    (1) You use some plugin for your browser (e.g. Modify Headers for Firefox) that allows you to modify/set HTTP headers and set the Accept header to "application/json". This is the suggested solution, as it also allows you to directly use subsequently the hypermedia links contained in the response and you can use the feature also to play around with other HTTP header based features like language preferences)
    (2) You use a feature of the Places API for client platforms that don't allow developers to set headers: Places API will internally overwrite the values of HTTP headers if it finds a query string parameter with the same name. You can make use of this and simply pass a different Accept-header value as additional query-string parameter. E.g. http://demo.places.nlp.nokia.com/pla...plication/json.
    Andreas Schmidt
    Nokia Places API

Similar Threads

  1. plain old chm sdk doc
    By julie_777 in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2011-07-20, 15:56
  2. JSON
    By atonical in forum Qt
    Replies: 1
    Last Post: 2010-10-09, 08:20
  3. How to download JSON ME Api "org.json.me.zip"
    By narendar_discover in forum Mobile Java Networking & Messaging & Security
    Replies: 5
    Last Post: 2010-05-01, 12:15
  4. JSON
    By danhicksbyron in forum Qt
    Replies: 1
    Last Post: 2010-04-15, 06:06
  5. json?!
    By programer_asal in forum Symbian
    Replies: 4
    Last Post: 2009-06-05, 02:50

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×