8

Hardly an hour goes by without someone asking a question about how to access a particular piece of data that they got from parsing JSON. The most recent is

Retrieving JSON and extracting a specific value

It seems like 99% of the time, as in this one, they just didn't notice that part of the object is an array, and they need to index it.

Are these questions really of any value to the community? Every one of them is a one-off, although I suppose if someone read one of them it might give them a clue to the mistake they made in their program. They're all so trivial that it doesn't seem worthwhile posting a real answer -- I'd like to just post the corrected expression as a comment and close it, but what close reason?

Is there a canonical question that explains how to read JSON and turn it into access expressions? Then they could be closed as dupes of that. If there are different ones for various languages, that would be fine, too.

13
  • For the most part, it's not even JSON they're talking about. The example is actually asking, "How do I access something in this JavaScript object graph". Which, when you think about it, is JavaScript programming 101. Commented Sep 15, 2016 at 19:23
  • @MikeMcCaughan - then that qualifies them for too broad and a down vote.
    – user177800
    Commented Sep 15, 2016 at 19:24
  • 1
    s1.postimg.io/7ge8xeulr/flamethrower.jpg
    – Pekka
    Commented Sep 15, 2016 at 19:25
  • 1
    @Pekka웃 - youtube.com/watch?v=aCbfMkh940Q
    – user177800
    Commented Sep 15, 2016 at 19:28
  • You could create your own. Ask a very general question about parsing json, then add an answer that details specific scenarios. Then close as dupe away.
    – user1228
    Commented Sep 15, 2016 at 19:43
  • 1
    I close as a dup of stackoverflow.com/questions/11922383/…. "Too broad" seems wrong to me.
    – user663031
    Commented Sep 15, 2016 at 20:11
  • @JarrodRoberson One issue with all these "trivial logic errors" is that they're extremely common. Things like forgetting an index when processing nested structures, = instead of ==, using || instead of && when testing for a variable not equal to many things, forgetting parentheses when using AND and OR together in SQL, etc. So answers are likely to help future readers, except that they'll never find the previous questions on their own.
    – Barmar
    Commented Sep 15, 2016 at 20:27
  • @MikeMcCaughan I've long ago decided that I'm not interested in tilting at windmills. So I don't bother trying to correct the JSON vs. data terminology, or telling people to switch from mysql to mysqli/PDO, etc. I want to help them with the practical issues in their programming, not get caught up in minutiae.
    – Barmar
    Commented Sep 15, 2016 at 20:32
  • @Barmar Yeah, I wasn't suggesting wading into that swamp, just that it's so basic to JavaScript (and indeed many, many other languages) that I wonder why people seem to have such problems with it, and that perhaps, as you were saying, it should not be entertained on SO. Commented Sep 15, 2016 at 20:37
  • 3
    @MikeMcCaughan I wonder why people have such problems with many of the things they ask about. I think the root cause is that many people are trying to program who just don't have the right kind of logical mind for it. They don't understand the general processes, they're just learning everything by rote. How many times have you seen someone say they didn't think they could use some function in a particular context, because they thought it could only be used in some other way.
    – Barmar
    Commented Sep 15, 2016 at 20:41
  • I don't know why people think this is related to mental typo, except for the fact that I guess in this particular subcategory of these cases it can be considered a mental typo to omit the array index reference. But there are many questions of this kind which are not about mental typos, but are rather just "how to access the a property in the b property.
    – user663031
    Commented Sep 16, 2016 at 5:02
  • LINQ question in the c# tag has similar issues. Users want someone to write a customized query to solve their very specific use case and not try to figure out the query on their own from all of the existing posts on SO and on other sites Commented Sep 20, 2016 at 16:24
  • @psubsee2003 That's the common problem of "Write this for me" posts. Just vote to close as "Too broad".
    – Barmar
    Commented Sep 20, 2016 at 16:26

2 Answers 2

6

Is there a canonical question that explains how to read JSON and turn it into access expressions?

2
  • 1
    Thanks, I've bookmarked them for future reference.
    – Barmar
    Commented Sep 15, 2016 at 20:29
  • 1
    That JS post is a fantastic canonical that I will regularly be using as a dupe target.
    – ssube
    Commented Sep 20, 2016 at 21:15
-7

Too Broad

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.

There are too many ways to process JSON in each language to have a canonical answer that does not turn into a recommendations question/answer.

The problem is they are a form or too localized. Which does not exist anymore and was superseded in spirit with too broad in that how to parse JSON in what ever language or how do I debug or how do I pay more attention to what I am doing is actually the answer.

Maybe we need too narrow as a close reason since too localized has such a stigma now.

3
  • 3
    But the questions are not actually about parsing, they're about basic observation of the data.
    – davidism
    Commented Sep 15, 2016 at 19:22
  • 1
    If that is the case then this question is just a duplicate of Closing as a Mental Typo in spirit if not in practice.
    – user177800
    Commented Sep 15, 2016 at 19:27
  • 1
    I disagree that "too localized was superseded in spirit by too broad". They are quite different. Most of these questions should can and should be downvoted, but I don't think they fall cleanly into any of the available close reasons.
    – user663031
    Commented Sep 15, 2016 at 20:14

You must log in to answer this question.

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