http://qs321.pair.com?node_id=890534


in reply to Replacement of Bracketed Expressions for JSON output

If you are regularly working with JSON, have you considered using JSON?

I realize there are times when one just wants something quick and dirty and throwaway. However, if this is more than a one-off throw-away need, devoting time to developing a collection of regexes to work with a well established streaming format seems to me a bit foolish. The code one writes will not have anywhere near the degree of long term reusability and reliability that a proper parsing module will.

For example, can you be sure that your arrays will always have only scalar elements? What about arrays nested in arrays? Arrays of hashes? That isn't even a question you need to worry about if you use a module that knows how to parse JSON in full.

  • Comment on Re: Replacement of Bracketed Expressions for JSON output