Invalid JSON


This is returning invalid JSON.

See snippet of JSON string below.

Note “Source” element.

"statuses_count": 1958,
    "lang": "en",
    "status": {
        "created_at": "Tue Oct 08 23:45:42 +0000 2013",
        "id": 387725522739789800,
        "id_str": "387725522739789824",
        "text": "@cpeiffler @Rayterrill Clifford thx for the props! Ray, all our tech/online services are top notch. Check us out!",
        "source": "<a href="http: //" rel="nofollow">TweetDeck</a>",
        "truncated": false,
        "in_reply_to_status_id": 387639127601983500,
        "in_reply_to_status_id_str": "387639127601983490",
        "in_reply_to_user_id": 172028267,
        "in_reply_to_user_id_str": "172028267",
        "in_reply_to_screen_name": "cpeiffler",
        "geo": null,
        "coordinates": null,
        "place": null,

If you escape the URL like so, it’s valid.

"source": "<a href=\"http: //\" rel=\"nofollow\">TweetDeck</a>",

Is this is a known bug or do I have to work around this??


Have you taken a look at the raw response from the API? It looks more like:

“source”:"\u003ca href=“” rel=“nofollow”\u003eTweetDeck\u003c/a\u003e"

What are you using to process the response? Perhaps it is being munged?


Used your developer console to create the string . Pasted string in to PHP and tried to read using json_decode function.


When the web-based console formats the JSON, the act of consuming it can change it. It’s really just there for demonstrative purposes. You might find it more joyful to explore the API via commandline.


Makes perfect sense.

My hope is to get the data into a PHP array or object. Probably won’t get to work on this until next week, but I will let you know how I make out. In the meantime, any suggestions on methods to consume the data are welcome! (I hate re-inventing the wheel!)

PS Corey Feldman? What’s up with that?


You were correct. Everything is working great. Thanks!


@JohnPDX I am also facing same problem, I hope u resolved it . Please tell me the steps to resolve it.


My take on this is that it’s not solved and that we shouldn’t use the developer console for anything useful. It’s just for the show. I’ve started to use Postman (a Chromium/Chrome app) for this purpose, it works fine.