SEXP R_isValidJSON(SEXP input) { const char *txt; int status = 0; txt = CHAR(STRING_ELT(input, 0)); status = json_is_valid(txt); return(ScalarLogical(status)); }
void JSON_Parse_text(sLONG_PTR *pResult, PackagePtr pParams) { C_TEXT source; C_TEXT returnValue; source.fromParamAtIndex(pParams, 1); std::wstring w; _copyString(source, w); if(json_is_valid(w.c_str())){ JSONNODE *n = json_parse(w.c_str()); _addJsonRootToList(n); _toHex(n, returnValue); } returnValue.setReturn(pResult); }