JavaScript Object Notation

  • Deborah Nolan
  • Duncan Temple Lang
Part of the Use R! book series (USE R)


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.


Character Vector Numeric Vector Apache Software Foundation Associative Array Primitive Data Type 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    10gen, Inc. The MongoDB NoSQL database., 2011.
  2. [2]
    Daniel Adler. rdyncall: Improved foreign function interface (FFI) and dynamic bindings to C libraries (e.g., OpenGL)., 2012. R package version 0.7.5.
  3. [3]
    Apache Software Foundation. Apache Lucene: Open-source search software., 2011.
  4. [4]
    Apache Software Foundation. Spam Assassin: A spam filter that can be used on a wide variety of email systems., 2011.
  5. [5]
    Shay Banon. Elasticsearch: An open source, distributed, RESTful search engine., 2011.
  6. [6]
    Gabriel Becker and Duncan Temple Lang. RBrowserPlugin: R in the Web browser., 2012. R package version 0.1-5.
  7. [7]
    Alex Couture-Beil. rjson: Converts R object into JSON and vice-versa., 2011. R package version 0.2.6.
  8. [8]
    Douglas Crockford. JavaScript: The Good Parts. O’Reilly Media, Inc., Sebastopol, CA, 2008.Google Scholar
  9. [9]
    Dirk Eddelbuettel and Romain Francois. Rcpp: Seamless R and C++ integration., 2011. R package version 0.9.15.
  10. [10]
    Bryan English. JPath: A JavaScript class which provides an XPath -like querying ability to JSON objects., 2011.
  11. [11]
    David Flanagan. JavaScript: The Definitive Guide. O’Reilly Media, Inc., Sebastopol, CA, 2006.Google Scholar
  12. [12]
    Markus Gesmann and Diego de Castillo. googleVis: Interface between R and the Google Visualisation API., 2011. R package version 0.2.13.
  13. [13]
    Stefan Goessner. JSON Path – XPath for JSON., 2011.
  14. [14]
    Google, Inc. Google News: A news aggregator service., 2011.
  15. [15]
    Google, Inc. Google Visualization API reference., 2012.
  16. [16]
    Lars Magne Ingebrigtsen. Gmane: A public mailing list archive., 2011.
  17. [17]
    JSON Advocate Group. Introducing JSON: A lightweight data-interchange format., 2006.
  18. [18]
    Kiva Organization. Kiva: Loans that change lives., 2011.
  19. [19]
    Gerald Lindsly. rmongodb: R-MongoDB driver., 2011. R package version 1.0.3.
  20. [20]
    Deborah Nolan and Duncan Temple Lang. SVGAnnotation: Tools for post-processing SVG plots created in R., 2011. R package version 0.9.
  21. [21]
    Jeroen Ooms. opencpu.encode: Encodes R objects to a standardized JSON format., 2012. R package version 0.22.
  22. [22]
    R Core Team. Writing R Extensions. Vienna, Austria, 2012.
  23. [23]
    Duncan Temple Lang. RGCCTranslationUnit: R interface to GCC source code information., 2009. R package version 0.4-0.
  24. [24]
    Duncan Temple Lang. RJSONIO: Serialize R objects to JSON (JavaScript Object Notation)., 2011. R package version 0.95.
  25. [25]
    The JSON Schema Community. JSON schema: A JSON-based format for describing JSON data., 2011.
  26. [26]
    The New York Times Company. The Times Developer Network: An API clearinghouse and community., 2012.
  27. [27]
    W3Schools, Inc. JSON tutorial., 2012.
  28. [28]
    Jonathan Wallace. The libjson project: A JSON reader and writer., 2012.

Copyright information

© Springer Science+Business Media New York 2014

Authors and Affiliations

  • Deborah Nolan
    • 1
  • Duncan Temple Lang
    • 2
  1. 1.Department of StatisticsUniversity of CaliforniaBerkeleyUSA
  2. 2.Department of StatisticsUniversity of CaliforniaDavisUSA

Personalised recommendations