Live data from Hacker News

Select Transform: JSON template over JSON

selecttransform.github.io

1–10 of 76 posts

Re: Select Transform: JSON template over JSON

#4
Currently I'm having issues trying to figure out a new stack where we can't figure out where to put the backend for front-end logic in a React App over the top of GraphQL. I've been thinking of implementing something like this as the transforms or the formatters don't make a ton of sense to be on the client or the API or in GraphQL and I'm loathe to make another API call in the chain as it feels like I there's enough of those already?

Would that be a good use case for this?

Re: Select Transform: JSON template over JSON

#5
post #3

XSLT for JSON?

That's the first thing that came to my mind too. XSLT is very powerful but also incredibly messy because it has to be expressed in XML. Doing the same in JSON seems like it would result in the same problem.

all code generators that are not code end up being like that. and just yesterday there was an article about that magazine reporting the end of programming because of some BASIC code generator. heh.

dbaseIIIplus was the one that actually almost managed this feat.

Re: Select Transform: JSON template over JSON

#8
post #4

Currently I'm having issues trying to figure out a new stack where we can't figure out where to put the backend for front-end logic in a React App over the top of GraphQL. I've been thinking of implementing something like this as the transforms or the formatters don't make a ton of sense to be on the client or the API or in GraphQL and I'm loathe to make another API call in the chain as it feels like I there's enough…

Creator here. Yup, in fact you can check out something like that here https://github.com/SelectTransform/JSONQL

Basically you can send the JSON template over JSON to the server, and let the server transform the raw data using the template before returning.

The most important benefit here is that, since everything can be expressed in JSON, it can be stored or transmitted over the Internet, which enables interesting cases like this.

Re: Select Transform: JSON template over JSON

#10

XSLT for JSON?

I could imagine use cases for this for example for REST apis that consume json and then have to transform it generically to some other json for db storage in a document database. The internal storage could change over time with the outside spec staying the same, and such transforms could be used to do the mapping per version.

This particular implementation looks a bit messy though - XSLT is valid XML and Xpath, while this solution uses templating syntax. That's more human readable, but also slightly inconsequent - you wouldn't be able to validate such a template with json schema for example.

Post reply on HN