Abstract
In this chapter, we describe the JSON format and then the fromJSON() and toJSON() functions to both read and create JSON content. Because JSON is so simple and there are few supporting technologies for JSON, there are not many details that we need to examine before being able to work with JSON effectively. As a result, we spend a significant part of this chapter illustrating how we work with JSON in different contexts. These display other technologies that use JSON which are interesting in their own right. We look at reading JSON data from both Web services and from local files. We also show how to serialize data from R to JSON in order to add it to interactive HTML and SVG documents. Finally, we explore the ElasticSearch text search engine and how we use JSON to both insert documents into the engine and receive query results from the engine.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
10gen, Inc. The MongoDB NoSQL database. http://www.mongodb.org, 2011.
Daniel Adler. rdyncall: Improved foreign function interface (FFI) and dynamic bindings to C libraries (e.g., OpenGL). http://cran.r-project.org/package=rdyncall, 2012. R package version 0.7.5.
Apache Software Foundation. Apache Lucene: Open-source search software. http://lucene.apache.org, 2011.
Apache Software Foundation. Spam Assassin: A spam filter that can be used on a wide variety of email systems. http://spamassassin.apache.org, 2011.
Shay Banon. Elasticsearch: An open source, distributed, RESTful search engine. http://www.elasticsearch.org, 2011.
Gabriel Becker and Duncan Temple Lang. RBrowserPlugin: R in the Web browser. https://github.com/gmbecker/RFirefox, 2012. R package version 0.1-5.
Alex Couture-Beil. rjson: Converts R object into JSON and vice-versa. http://cran.rproject.org/web/packages/rjson/, 2011. R package version 0.2.6.
Douglas Crockford. JavaScript: The Good Parts. O’Reilly Media, Inc., Sebastopol, CA, 2008.
Dirk Eddelbuettel and Romain Francois. Rcpp: Seamless R and C++ integration. http://cran.r-project.org/package=Rcpp, 2011. R package version 0.9.15.
Bryan English. JPath: A JavaScript class which provides an XPath -like querying ability to JSON objects. http://bluelinecity.com/software/jpath, 2011.
David Flanagan. JavaScript: The Definitive Guide. O’Reilly Media, Inc., Sebastopol, CA, 2006.
Markus Gesmann and Diego de Castillo. googleVis: Interface between R and the Google Visualisation API. http://cran.r-project.org/package=googleVis, 2011. R package version 0.2.13.
Stefan Goessner. JSON Path – XPath for JSON. http://goessner.net/articles/JsonPath/, 2011.
Google, Inc. Google News: A news aggregator service. http://news.google.com, 2011.
Google, Inc. Google Visualization API reference. https://developers.google.com/chart/interactive/docs/reference, 2012.
Lars Magne Ingebrigtsen. Gmane: A public mailing list archive. http://gmane.org, 2011.
JSON Advocate Group. Introducing JSON: A lightweight data-interchange format. http://www.json.org/, 2006.
Kiva Organization. Kiva: Loans that change lives. http://www.kiva.org/, 2011.
Gerald Lindsly. rmongodb: R-MongoDB driver. http://cran.r-project.org/package=rmongodb, 2011. R package version 1.0.3.
Deborah Nolan and Duncan Temple Lang. SVGAnnotation: Tools for post-processing SVG plots created in R. http://www.omegahat.org/SVGAnnotation, 2011. R package version 0.9.
Jeroen Ooms. opencpu.encode: Encodes R objects to a standardized JSON format. http://cran.r-project.org/web/packages/opencpu.encode/, 2012. R package version 0.22.
R Core Team. Writing R Extensions. Vienna, Austria, 2012. http://cran.r-project.org/doc/manuals/r-release/R-exts.html.
Duncan Temple Lang. RGCCTranslationUnit: R interface to GCC source code information. http://www.omegahat.org/RGCCTranslationUnit, 2009. R package version 0.4-0.
Duncan Temple Lang. RJSONIO: Serialize R objects to JSON (JavaScript Object Notation). http://www.omegahat.org/RJSONIO, 2011. R package version 0.95.
The JSON Schema Community. JSON schema: A JSON-based format for describing JSON data. http://json-schema.org/, 2011.
The New York Times Company. The Times Developer Network: An API clearinghouse and community. http://developer.nytimes.com/docs/campaign_finance_api/campaign_finance_api_examples, 2012.
W3Schools, Inc. JSON tutorial. http://www.w3schools.com/json/default.asp, 2012.
Jonathan Wallace. The libjson project: A JSON reader and writer. http://sourceforge.net/projects/libjson/, 2012.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2014 Springer Science+Business Media New York
About this chapter
Cite this chapter
Nolan, D., Lang, D.T. (2014). JavaScript Object Notation. In: XML and Web Technologies for Data Sciences with R. Use R!. Springer, New York, NY. https://doi.org/10.1007/978-1-4614-7900-0_7
Download citation
DOI: https://doi.org/10.1007/978-1-4614-7900-0_7
Published:
Publisher Name: Springer, New York, NY
Print ISBN: 978-1-4614-7899-7
Online ISBN: 978-1-4614-7900-0
eBook Packages: Mathematics and StatisticsMathematics and Statistics (R0)