Description Usage Arguments Value Examples
ft_serialize
helps you convert to various data formats. If
your data is in unparsed XML (i.e., character class), you can convert to
parsed XML. If in XML, you can convert to (ugly-ish) JSON, or a list.
1 2 3 | ft_serialize(x, to = "xml", from = NULL, ...)
ft_get_keys(x)
|
x |
Input object, output from a call to |
to |
(character) Format to serialize to. One of list, xml, or json. Required. Output to xml returns object of class XMLInternalDocument. |
from |
(character) Format |
... |
Further args passed on to |
An object of class ft_parsed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Not run:
res <- ft_get('10.7717/peerj.228')
# if articles in xml format, parse the XML
(out <- ft_serialize(ft_collect(res), to='xml'))
out$peerj$data$data[[1]] # the xml
# From XML to JSON
(out <- ft_serialize(ft_collect(res), to='json'))
out$peerj$data$data$`10.7717/peerj.228` # the json
jsonlite::fromJSON(out$peerj$data$data$`10.7717/peerj.228`)
# To a list
out <- ft_serialize(ft_collect(res), to='list')
out$peerj$data$data
out$peerj$data$data[[1]]$body$sec$title
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.