Hacker News new | ask | show | jobs
by evincarofautumn 3418 days ago
In my opinion, XSLT is a disappointing implementation of a great idea: a DSL for structurally transforming a data format, encoded in the same data format. I guess S-expressions fit the bill if you want to use a Lisp, but I wouldn’t mind having something similar for JSON.
2 comments

I very much agree with your sentiment here. That's why I find Haskell lenses so fascinating. Although it's another level of challenge since it's done on a type level.

> something similar for JSON

And I've looked for this as well. Haven't really tried any solution in the trenches but this one might be interesting for you: https://github.com/mmckegg/json-query

Also, GraphQL is tangentially related.

Realizing just how excruciating that sounds, I think am a notch or two closer to appreciating the merits of s-expressions.
I’m curious why it sounds painful to you. I didn’t mean to imply we should reimplement XSLT in JSON syntax, just that some JSON description of a stylesheet, to be applied to JSON data, could be useful.
It very well might be. My feeling was just more or less: I don't love JSON syntax or the tendency towards big, hierarchical JSON documents overmuch (though it's certainly been a massive real-world improvement on XML for most of the overlapping use cases I'm familiar with), so describing transformations on data in it sounds likely to be unpleasant.

Perhaps one of these decades I will actually learn a Lisp.