Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I must be missing something obvious. How is Tim's JWalk example different than doing:

  try { 
     var key = json_object.them.public_keys.primary.bundle;
  } ...
Is it to better allow dynamic keys? More consistent error handling?


Well, it's in Java, for one thing.


So this "fat JSON" problem is Java's problem, not JSON's, then? The above code could be perfectly valid C#, as well as valid JavaScript.

On the other hand, if you're hardcoding assumptions about the JSON structure into your Java (which you're doing even if you pass a string literal to some API to look up a value for you), you could probably employ some lightweight code generation to spin you up some classes with strongly typed public fields named things like 'them' and 'public_keys' to help you write more idiomatic JSON access code.


> So this "fat JSON" problem is Java's problem, not JSON's, then?

Pretty much.

I would expect that Java could offer some sort of solution to this problem, ideally with an accessor syntax similar to what you'd find in Javascript or, as you say, C#. On the other hand, I've never delved deeply enough into Java to know whether it's feasible; I suppose it's possible that the language simply isn't flexible enough to make such a solution workable.


D'oh, thank you.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: