I think this article is somewhat off-base. The problem isn't JSON, it's lack of respect for separation of duties. JSON is just a data exchange format.
Want to program in an OO way using JSON? Easy. Just build a factory to generate objects from JSON input. Put your validation and error handling right there. Now you can get a known valid object from the JSON, a class instance with all the encapsulation and business logic your heart desires. Need to share it with the outside world? Provide a JSON output method.
Translating data formats is at the heart of day-to-day programming. It ain't rocket surgery. Fix the problem, not the blame.
(And if you think JSON sucks, believe me, you never dealt with data file formats from the pre-XML days!)
The same programming style exists quite a bit in older PHP code as well. This is because one of it's primary data types is an list/hashtable hybrid. And JSON is similar -- it promotes those same structural types; the list and the hashtable (array and object, respectively). So programmers are using them, not just for building structures for data interchange, but for actual programming logic.
Want to program in an OO way using JSON? Easy. Just build a factory to generate objects from JSON input. Put your validation and error handling right there. Now you can get a known valid object from the JSON, a class instance with all the encapsulation and business logic your heart desires. Need to share it with the outside world? Provide a JSON output method.
Translating data formats is at the heart of day-to-day programming. It ain't rocket surgery. Fix the problem, not the blame.
(And if you think JSON sucks, believe me, you never dealt with data file formats from the pre-XML days!)