26

The question How to deal with malformed json response? NOT A DUPLICATE ! !? to my understanding asks about parsing JSONP and I've closed it as duplicate suggesting string-parsing workarounds. Original author indeed disagrees (and I agree that question looks for better alternatives as there a comment on one of answers along these lines), but unfortunately they believe that adding "NOT A DUPLICATE" is enough to clarify the question.

I tried to explain that I believe question need to be edited, but clearly it did not work. Normally I'd edit a question with necessary information, but OP does not look to be happy about edits rolling back several other changes (https://stackoverflow.com/posts/48470971/timeline).

Should I

  1. just forget altogether about this question
  2. downvote due to random text in the post and move on
  3. try to edit the post
  4. just reopen
  5. something else?

I think to go with 1 (forget about it)...


Side notes:

  • If there are positive suggestions to OP this question can be converted into "how to properly edit for reopen" (I've already provide link to "This question may already have an answer here" - but it does not, so only specific suggestions would help)
  • I think downvotes on the question come after OP added "NOT A DUPLICATE" to the title as original version looked quite reasonable.
3
  • 3
    Oh no, I got caught in the edit war. Commented Jan 28, 2018 at 1:06
  • @SotiriosDelimanolis I've mod flagged this post before you edited it (Was hoping they would clean it up before another innocent soul got caught in the crossfire). I think it's best to let them sort it out
    – Blue
    Commented Jan 28, 2018 at 4:23
  • 2
    Summary so far: question got plenty of downvotes, but finally edited and re-opened. If you voted due to "NOT A DUPLICATE" in title - consider to reconsider :). Looking through JSONP tag it is probably the most complete Q/A pair so far. Commented Jan 29, 2018 at 1:39

3 Answers 3

26

The asker's behaviour is arguably wrong, but I think his claim is substantively right: the "duplicate" is indeed not a duplicate. Not because "How to parse JSONP using JSON.NET?" isn't effectively what he's asking - it is, even if he doesn't know it - but because that's not what the linked "duplicate" is asking, even though it's the title.

Rather, the duplicate question is in effect asking

I'm in the middle of writing code to parse a JSONP response, but the code dies when it encounters some escape sequence that JSON.NET doesn't understand; how can I fix that?

That's a significantly different question, that assumes a bunch of shared understanding about what JSONP is and how one would go about parsing it from a non-JavaScript environment that the newer question asker clearly does not have.

Also, the approach shown at the linked duplicate is buggy; in the general case, you can't safely just do a string replace to remove the callback name and open parenthesis from the start of a JSONP response, because that same sequence of characters might legitimately appear in a string within the JSON object that you're trying to parse; a find-and-replace across the entire string, as shown here, risks modifying the result. I can't reasonably point this out in an answer, though, because it's irrelevant to the question that was asked, which was about escape sequences breaking the parser.

The root problem here is that people who are really asking debugging questions frequently ask them with broad how-to titles. (Worse, many answerers encourage this by commenting on how-to questions to demand that people show what they've tried - effectively mutating how-to questions into debugging questions or some weird hybrid between the two.) When picking duplicate targets, you need to be conscious of this phenomenon and not just treat a question's title as an accurate summary of what it's asking. This one wasn't, and as such I'm voting to reopen the question that you closed. (Though perhaps there's a better duplicate out there, in which case reclose it against that.)

5
  • 2
    In this case though, the other question does provide an answer. I'd think that's okay to leave closed as a duplicate but I'll admit it's iffy.
    – user743382
    Commented Jan 28, 2018 at 15:33
  • 3
    @hvd Except that it's a broken answer - see my third paragraph.
    – Mark Amery
    Commented Jan 28, 2018 at 15:34
  • Yeah, agreed with that part.
    – user743382
    Commented Jan 28, 2018 at 16:36
  • "The root problem here is that people who are really asking debugging questions frequently ask them with broad how-to titles" which is why most of my (and a bunch of other editors) edits are on titles...
    – Braiam
    Commented Jan 28, 2018 at 19:29
  • 5
    +1 for "mutating how-to questions into debugging questions". I wish people didn't do that. Sure, sometimes you do need to narrow down the question to make it answerable, and sometimes (all too often) a question with a "how to" title really is a debugging question. But if your only reason for asking the OP to show what they've tried is because you think they're being lazy and don't deserve an answer, please don't. Just downvote and move on, or look for a duplicate if you think there should be one. But don't make the OP narrow down their question so much that it becomes useful only to them. Commented Jan 28, 2018 at 20:35
4

I interpreted the question somewhat differently than Alexei Levenkov. I understood it to be asking:

I am trying to deserialize some JSON from a stream. The "JSON" contains some prefix and postfix text I would like to ignore. How can I skip the prefix and postfix text while still reading and deserializing directly from stream rather than loading the entire stream into a string?

In that sense the question is more about manipulation of streams and text readers rather than parsing JSONP with Json.NET.

Phrased that way, I thought that question would be answerable (by me), and not a duplicate. But the edit war around the question made me reluctant to make any changes to it, and I'm not 100% my interpretation of the question is correct, since nowhere in the title or the text of the question is it stated that a streaming solution is necessary. With that clarification edited into the question I'd vote to reopen it.

1
  • 2
    Yes, I believe this is what OP would like to ask. Question is currently re-opened with edit asking exactly that - feel free to answer (hopefully OP will not roll back that edit too). Commented Jan 29, 2018 at 1:01
-10

We have just discovered that the question is NOT a duplicate. We all agree.

The obvious action is to edit the title and post so that only the question is focussed on and REMOVE the "duplicate" tag.

The OP's response to being marked as a duplicate is childish, defensive and emotional. It's easy to be upset when there is a feeling of hopelessness.

We should be able to act without emotion to clean up the question and answers for future SO visitors to come and get the answers this site was created for.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .