[Rcpp-devel] Manipulating json with Rcpp

Neal Fultz nfultz at gmail.com
Thu Oct 11 22:43:44 CEST 2018


(Resending to list, sorry)

| I was pleasantly surprised how easy it was to make a header-only package
> | (by cannabalizing BH and copying the hpp file to inst/include).
>
> Why?  Is LinkingTo: BH not good enough?
>

I'm not using Boost for json, instead using this
https://nlohmann.github.io/json/ for the
syntax sugar.

But I wanted to start with something that was working instead of starting
from scratch, in case
there were package configuration that had to be set to make //
[[Rcpp::depends(RcppJson)]]
compile correctly. But Rcpp::depends seems to find everything
automatically, it "just works".



> | Maybe someone else will find this useful some day.
>
> There are also R (at least) cpp-using package ndjson and validatejsonr on
> CRAN.
>

Those are good finds. Not sure if you can use them from inside C++ though.

It looks like Bob Rudis is also using the nlohmann/json.h, maybe I can ask
him to
move json.h from src/ to inst/include for his next release. I think that's
all that needed
to make Rcpp::depends / LinkingTo work.

On Thu, Oct 11, 2018 at 12:18 PM Dirk Eddelbuettel <edd at debian.org> wrote:

>
> On 11 October 2018 at 11:50, Neal Fultz wrote:
> | I recently needed to deal with json on the C++ side of things, and found
> | the nlohmann json library.
> |
> | I made a small wrapper package: https://github.com/nfultz/RcppJson
>
> Cool.
>
> | I was pleasantly surprised how easy it was to make a header-only package
> | (by cannabalizing BH and copying the hpp file to inst/include).
>
> Why?  Is LinkingTo: BH not good enough?
> |
> | Maybe someone else will find this useful some day.
>
> There are also R (at least) cpp-using package ndjson and validatejsonr on
> CRAN.
>
> Dirk
>
> --
> http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20181011/8161a1fd/attachment.html>


More information about the Rcpp-devel mailing list