library(nexld)
library(jsonlite)
library(jsonld)
library(magrittr)

Look, we can roundtrip without breaking validity!

  ex <- system.file("extdata/example.xml", package = "nexld")
  xml_to_json(ex, "ex.json")

  json <- parse_nexml(ex)
  xml <- json_to_xml(json)

  xml2::write_xml(xml, "ex.xml")
  nexld::nexml_validate("ex.xml")
  #unlink("ex.xml")

Time for some fun.


f <- system.file("extdata/example.xml", package = "nexld")
json <- nexld::parse_nexml(f)

json %>% write_json("example.json", pretty = TRUE, auto_unbox=TRUE)
readr::read_lines("example.json", n_max = 20) %>% cat(sep="\n")
nexld::xml_to_json(f, "example.json")
readr::read_lines("example.json", n_max = 10) %>% cat(sep="\n")
x <- xml_to_json(f)
json_to_xml(x, "ex.xml")
f <- system.file("extdata/ontotrace.xml", package = "nexld")

json <- nexld::parse_nexml(f)

json %>% write_json("example.json", pretty = TRUE, auto_unbox=TRUE)
readr::read_lines("example.json", n_max = 20) %>% cat(sep="\n")
class(json)


cboettig/nexld documentation built on Sept. 18, 2019, 7:11 a.m.