Skip to content

Commit

Permalink
not right #69
Browse files Browse the repository at this point in the history
  • Loading branch information
dcooley committed May 28, 2020
1 parent 78b4961 commit e010a35
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
3 changes: 2 additions & 1 deletion inst/include/jsonify/from_json/from_json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ namespace from_json {
}
case rapidjson::kFalseType: {}
case rapidjson::kTrueType: {
return Rcpp::wrap< bool >( json.GetBool() );
//return Rcpp::wrap< bool >( json.GetBool() );
return Rcpp::wrap< bool >( json );
}
case rapidjson::kStringType: {
return Rcpp::wrap( std::string( json.GetString() ) );
Expand Down
39 changes: 38 additions & 1 deletion inst/include/jsonify/jsonify.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,46 @@
#ifndef R_JSONIFY_H
#define R_JSONIFY_H

#include <Rcpp.h>
#include "rapidjson/document.h"

#include <RcppCommon.h>

namespace Rcpp {

template< typename T > SEXP wrap( const rapidjson::Value::ValueType& obj );

namespace traits {

} // traits
} // Rcpp




#include <Rcpp.h>



namespace Rcpp {

template< typename T >
SEXP wrap( const rapidjson::Value::ValueType& obj) {
const int RTYPE = Rcpp::traits::r_sexptype_traits< T >::rtype;

return Rcpp::wrap< RTYPE >( obj.Get< T >() );
}


namespace traits {


} // traits
} // Rcpp





#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
#include "rapidjson/prettywriter.h"
Expand Down

0 comments on commit e010a35

Please sign in to comment.