Thank you for sending the URL.  Sorry for the delay in my response, but I'm
posting my response here as other developers may find some help.

Orkut expects JSON keys to be enclosed in quotes.  The url returned:

{ value_1 : "3", value_2 : "5"}

To be parsed by the make request function, this should be:

{ "value_1" : "3", "value_2" : "5"}

Which will populate the data attribute on the response object.

If you are using PHP, there's a function called json_encode which will
correctly encode arrays and objects in this method.  Other server-side
languages should have similar languates as well.

Hope this helps,
~Arne


On Fri, Feb 15, 2008 at 11:34 AM, Nikhil Gupte <[EMAIL PROTECTED]>
wrote:

>
> Hi Arne,
>
> I've emailed the URL to you.
>
> On Feb 16, 12:04 am, "Arne Roomann-Kurrik" <[EMAIL PROTECTED]>
> wrote:
> > Hi Nikhil,
> >
> >   Could you share the URL that you are fetching?  If you don't want to
> share
> > this publicly, please email it to me.
> >
> > Thanks,
> > ~Arne
> >
> > On Fri, Feb 15, 2008 at 1:49 AM, Nikhil Gupte <[EMAIL PROTECTED]>
> wrote:
> >
> > > Forgot to mention, the JSON document contains:
> > > {b: "b", a: "a"}
> >
> > > This is also seen in response.text
> >
> > > On Feb 15, 2:44 pm, Nikhil Gupte <[EMAIL PROTECTED]> wrote:
> > > > Jason,
> >
> > > > Thanks for looking into this. Following is my code:
> > > > -----START-----
> > > > function fetchData(url, callback) {
> > > >   var params = {};
> > > >   params[gadgets.io.RequestParameters.CONTENT_TYPE] =
> > > > gadgets.io.ContentType.JSON;
> > > >   gadgets.io.makeRequest(url, function(response) {
> > > >         console.log(response)
> > > >         var data = response.data;
> > > >         if (data == null) {
> > > >           console.log("Error fetching URL: " + response.errors);
> > > >         } else {
> > > >           callback(data);
> > > >         }
> > > >     }, params);}
> >
> > > > ----END-----
> >
> > > > The response.data is null, response.text has the JSON as text and
> > > > response.errors is "failed to parse JSON"
> >
> > > > Jason wrote:
> > > > > When are you seeing this error? Is this after the JSON string is
> > > > > returned from your server? If so, how are you parsing it? JSON
> > > > > responses are stored in the response object's 'data' property
> > > > > (response.data as opposed to response.text) so this may be part of
> > > > > your problem. If you are able to post a code snippet from your
> > > > > callback, it may help to track down the exact cause of your
> problem.
> >
> > > > > - Jason
> >
> > > > > On Feb 14, 6:23 am, Nikhil Gupte <[EMAIL PROTECTED]> wrote:
> > > > > > I'm getting errors in gadgets.io.makeRequest when I try to fetch
> > > JSON
> > > > > > documents.
> > > > > > My document is simple:
> > > > > > {score: "20"}
> >
> > > > > > The response.text for it in Firebug is
> > > > > > "{score: \"20\"}"
> >
> > > > > > The exact error is:
> > > > > > "failed to parse JSON"
> >
> > > > > > Is this an Orkut/Open Social bug or am I missing something?
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Orkut Developer Forum" group.
To post to this group, send email to opensocial-orkut@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/opensocial-orkut?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to