rgrinberg / opium

Sinatra like web toolkit for OCaml
MIT License
755 stars 67 forks source link

Support for yojson? #68

Closed tomjridge closed 7 years ago

tomjridge commented 7 years ago

ppx_deriving_yojson is pretty useful. Ezjsonm and jsonm don't seem to have equivalents. Would it be possible to somehow functorize over the json implementation? Obviously I can just pass yojson-as-string but this feels a bit hacky.

rgrinberg commented 7 years ago

I think you should do as you've suggested and use the String constructor. Jsonm is supported exactly the same way anyway, so you're not missing out on anything.

The body type could really use to be abstract at this point so that using yojson doesn't feel second class. But there really isn't a difference in practice.

I don't think functorizing makes sense as there's really only 1 function that uses this Json constructor of body anyway.

tomjridge commented 7 years ago

Cool. For the record, opium is fantastic.