JSON-Meth reviews

cpanratings
 

RSS | Module Info | Add a review of JSON-Meth

JSON-Meth (1.001006)

[Author's Review]

First, to respond to Ben Bullock's review: the ambiguity you mention is simply preserved by the module. I'm not sure why you expect the module to magically tell you whether your initial, completely random data is JSON or Perl. To put your question on its head: how would you know when to call to_json() or from_json() when using other JSON modules?

As for the actual review:
I don't recommend using the default $j method and instead you should explicitly request export and use the $json method. The $j is too cryptic and unintuitive and has no place in a production environment, past the semi-joke way this module was originally released.

In addition, by the nature of it, this module does not encode JSON that isn't an array or object at root, which it permitted by the more recent JSON spec, since that obviously leaves ambiguities with Perl strings. More specific conversion methods might be implemented by the module in the future, but currently I lack the tuits to do so. PRs are definitely welcome though.

JSON-Meth (1.001006)

From the module documentation:

> Don't make me think and give me what I want! This module automatically figures out whether you want to encode a Perl data structure to JSON or decode a JSON string to a Perl data structure.

So, in the event that you have something which may be a Perl data structure, or may be a string containing JSON, this module converts it into the other thing.

The problem I have with this, is how does that resolve the initial confusion? The output is either a string containing JSON or a Perl data structure. Even if we call the module twice, the confusion remains. It's as if someone made a module to help people who don't know their arse from their elbow, by exchanging their arse for their elbow. Surely this merely compounds the anatomical conundrum.

Edit: changed "for people" to "to help people".