REST API returns malformed JSON



I’m trying to get the list of someone’s followers.
But REST API sometimes returns malformed JSON which cannot be parsed as usual, so my app stops every time even I decrease the “count” parameter.
This is a REAL returned data from REST API which crashes my app.


Are you able to provide the API call and parameters that produces that response, please?

What are you using to parse the JSON inside your app?


API call is this (this is not a call when I posted, but it also returns malformed JSON):

GET followers/list?user_id=783214&count=50&cursor=1541075414351958046

I can’t dump the response because Wireshark doesn’t work well.

The library to parse the JSON is Newtonsoft.Json (used by CoreTweet).


I’ve just tried this using twurl and the response from that call seems to parse OK in JSONlint. I don’t see anything that breaks at the moment.

I can see that there is a malformed element in the raw.json file in your first post. However, I’m confused as to how you generated that JSON document - what tool or app are you using? If this is your own app, can you share the app ID (not the consumer keys), please?

Basically I’m struggling to reproduce this reliably.


Also, in your original post, the Tweet that appears to have “malformed” content which breaks the parser appears to be Tweet ID 758307575939133440 (please confirm that this matches your analysis?) - I can successfully pull that individual Tweet from the API and do not see this issue.



This is the code of the request of CoreTweet(used by my app)

And this is the app ID of my app: 12278991


I’m still unable to reproduce this issue with a specific Tweet or API response that contains a malformed element. I accept that the JSON you’ve posted at the top of this thread is not valid, but I cannot recreate it.