This imports data from New York Times' ArchieML format as a JSON sting. Text is parsed to JSON using archieml-js.
aml_to_json(aml, pretty = FALSE, indent = 4)
aml | a string, file, connection, URL, or Google Drive ID created by googledrive::as_id from which to read ArchieML. Inputs of length > 1, with line breaks, or non-existent filenames will always be treated as raw ArchieML. To read multiple ArchieML inputs use a function such as lapply. |
---|---|
pretty | prettify JSON output? |
indent | if prettifying, what indent level? Passed to prettify. |
A length-1 character vector of class "json"
aml_to_json(aml = "key: value")#> {"key":"value"}aml_to_json("http://archieml.org/test/1.0/arrays.1.aml")#> {"test":"[array] creates an empty array at array","result":"{\"array\": []}","array":[]}# See source at: # https://drive.google.com/open?id=1oYHXxvzscBBSBhd6xg5ckUEZo3tLytk9zY0VV_Y7SGs library(googledrive) aml_to_json(as_id("1oYHXxvzscBBSBhd6xg5ckUEZo3tLytk9zY0VV_Y7SGs"), pretty = TRUE)#> { #> "key": "value", #> "google-link": "This is a link.", #> "google-link-standalone": "http://www.nytimes.com/2016/04/03/us/politics/donald-trump-general-election.html?q=1#1", #> "google-link-standalone-raw": "http://www.nytimes.com/2016/04/03/us/politics/donald-trump-general-election.html?q=1#1", #> "smart-quotes": "<a href=“http://www.nytimes.com”>nytimes.com<\/a>", #> "array": [ #> "1", #> "2" #> ], #> "heading-link": "Link to heading 1", #> "heading1": "Heading 1", #> "heading2": "Heading 2", #> "heading3": "Heading 3", #> "heading4": "Heading 4", #> "heading5": "Heading 5", #> "heading6": "Heading 6", #> "nbsp": "Internal s are not converted", #> "bold-word": "This word is bolded.", #> "italic-word": "This word is italicized.", #> "underline-word": "This word is underlined.", #> "styled-word": "This word has many styles.", #> "strange-word": "This word is strange, but bold.", #> "bold-value": "This value is bolded.", #> "italic-value": "This value is italicized.", #> "underline-value": "This value is underlined.", #> "styled-value": "This value has many styles.", #> "bold-line": "This line is bolded.", #> "italic-line": "This line is italicized.", #> "underline-line": "This line is underlined.", #> "styled-line": "This line has many styles.", #> "soft-line-breaks": "Are treated as hard line breaks" #> } #>