Provided that it will not break the JSON for other language apps, the
solution is extremely simple for Twitter to implement, and it will
save a lot of us a lot of work and expense.

Just create any large numeric values in the JSON output as strings,
instead of numbers.

This goes for any large numbers, including tweet ids. As far as I am
concerned they can output everything in JSON as strings.

Thoughts, Twitter?

Dewald

On Sep 24, 12:08 pm, jmathai <jmat...@gmail.com> wrote:
> Agreed that the problem isn't Twitter's fault. But a basic feature
> like cursor should work in a language as popular as PHP.  Not so much
> in principle but in practice.
>
> Has anyone tried PEAR's Services_JSON?  I haven't tried nor looked at
> the source.  It's also slower than the native json_* functions but
> that may or may not be an issue.
>
> On Sep 24, 6:52 am, Joseph Cheek <jos...@cheek.com> wrote:
>
> > To be fair to Twitter, the problem lies in PHP's json_decode() function,
> > not the twitter API.
>
> > Joseph Cheek
> > jos...@cheek.com,www.cheek.com
> > twitter:http://twitter.com/cheekdotcom
>
> > Dewald Pretorius wrote:
> > > Chad,
>
> > > Shouldn't Twitter be providing an API that works for everyone?
>
> > > From what you said it sounds as if you're saying, "Tough. If you want
> > > to consume the API with PHP, either run your stuff on a 64-bit
> > > machine, or scrape the raw JSON output and make it so that it works
> > > for you."
>
> > > That doesn't sound right.
>
> > > Dewald
>
> > > On Sep 24, 1:02 am, Chad Etzel <c...@twitter.com> wrote:
>
> > >> Hello,
>
> > >> As Joseph points out, PHP on a 64-bit system can handle these numbers.
>
> > >> If you really want this data as a string, you could write a regex in
> > >> PHP to alter the json string to wrap the digits in quotes before
> > >> sending it through json_decode(), but that would be a pretty gnarly
> > >> kludge.
>
> > >> -Chad
>
> > >> On Wed, Sep 23, 2009 at 10:28 PM, Dewald Pretorius <dpr...@gmail.com> 
> > >> wrote:
>
> > >>> All that Twitter needs to do to solve this problem is to build the
> > >>> JSON out with next_cursor and previous_cursor as string values.
>
> > >>> I.e., the JSON data should contain:
>
> > >>> "next_cursor":"12398712981212987","previous_cursor":"-12398712981212987"
>
> > >>> I don't know what it will do to Java apps, but for PHP apps it will
> > >>> solve the problem.
>
> > >>> Dewald

Reply via email to