I just spent a few hours pulling my hair out on this so hopefully it
is useful for others:

The contacts API will return characters in its JSON responses that may
not be accepted by various parsers.  I tried with the jsonlint.com
website and PHP's json_decode() function.  PHP's json_decode() is very
twitchy and will simply return a null value instead of proper results
in the presence of certain characters.  The only one I could confirm
with 100% certainty was the tab character.  Google returns the tab as
a literal tab in the JSON, and it causes PHP's json_decode to fail.
Stripping the tab out of the json before passing it to json_decode
fixes the problem.

There are definitely other characters than tab but I gave up trying to
isolate them.  I switched to using Google's XML responses with PHP's
simplexml parser, and it's fine.  It's just a little more hassle as
the code to deal with XML is more complicated on the PHP side.

Anyway, hope this saves someone a few gray hairs in the future.

-jsd-

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Contacts API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to