SkillAgentSearch skills...

JSON2XML

Methods to convert a XML string into a JSON string, and to covert a JSON string into an XML string.

Install / Use

/learn @johndharrison/JSON2XML
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

JSON2XML

USAGE

Using JSON2XML is straightforward. There are two functions for conversion: json2XML and xml2JSON.

xml2JSON

require(JSON2XML)
fileURL <-  "http://api.sportsdatallc.org/nfl-t1/2013/REG/1/statistics.xml?api_key=4dhyq3f3rfkp2cbm4yqbcuag"
xData <- readLines(fileURL)
jData <- xml2JSON(paste(xData, collapse='')) # convert to JSON
out <- RJSONIO::fromJSON(jData)
do.call(rbind.data.frame, out$games$game[[1]]$team[[1]][[c('defense', 'player')]])

json2XML

require(JSON2XML)
jsonString <- RJSONIO::toJSON(list(a=1, r = list(b = 2:3, c= 'd')), collapse = '')
xData <- json2XML(jsonString)
XML::xmlParse(json2XML(jsonString))

Getting started

To install JSON2XML you will need the devtools package. If necessary (install.packages("devtools")) and run:

devtools::install_github("johndharrison/JSON2XML")

Related Skills

View on GitHub
GitHub Stars8
CategoryDevelopment
Updated1y ago
Forks0

Languages

R

Security Score

55/100

Audited on Feb 4, 2025

No findings