Skip to main content

JavaScript Object Notation

  • Chapter
  • First Online:
XML and Web Technologies for Data Sciences with R

Part of the book series: Use R! ((USE R))

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 10gen, Inc. The MongoDB NoSQL database. http://www.mongodb.org, 2011.

  2. 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.

  3. Apache Software Foundation. Apache Lucene: Open-source search software. http://lucene.apache.org, 2011.

  4. Apache Software Foundation. Spam Assassin: A spam filter that can be used on a wide variety of email systems. http://spamassassin.apache.org, 2011.

  5. Shay Banon. Elasticsearch: An open source, distributed, RESTful search engine. http://www.elasticsearch.org, 2011.

  6. Gabriel Becker and Duncan Temple Lang. RBrowserPlugin: R in the Web browser. https://github.com/gmbecker/RFirefox, 2012. R package version 0.1-5.

  7. 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.

  8. Douglas Crockford. JavaScript: The Good Parts. O’Reilly Media, Inc., Sebastopol, CA, 2008.

    Google Scholar 

  9. 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.

  10. Bryan English. JPath: A JavaScript class which provides an XPath -like querying ability to JSON objects. http://bluelinecity.com/software/jpath, 2011.

  11. David Flanagan. JavaScript: The Definitive Guide. O’Reilly Media, Inc., Sebastopol, CA, 2006.

    Google Scholar 

  12. 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.

  13. Stefan Goessner. JSON Path – XPath for JSON. http://goessner.net/articles/JsonPath/, 2011.

  14. Google, Inc. Google News: A news aggregator service. http://news.google.com, 2011.

  15. Google, Inc. Google Visualization API reference. https://developers.google.com/chart/interactive/docs/reference, 2012.

  16. Lars Magne Ingebrigtsen. Gmane: A public mailing list archive. http://gmane.org, 2011.

  17. JSON Advocate Group. Introducing JSON: A lightweight data-interchange format. http://www.json.org/, 2006.

  18. Kiva Organization. Kiva: Loans that change lives. http://www.kiva.org/, 2011.

  19. Gerald Lindsly. rmongodb: R-MongoDB driver. http://cran.r-project.org/package=rmongodb, 2011. R package version 1.0.3.

  20. 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.

  21. 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.

  22. R Core Team. Writing R Extensions. Vienna, Austria, 2012. http://cran.r-project.org/doc/manuals/r-release/R-exts.html.

  23. Duncan Temple Lang. RGCCTranslationUnit: R interface to GCC source code information. http://www.omegahat.org/RGCCTranslationUnit, 2009. R package version 0.4-0.

  24. Duncan Temple Lang. RJSONIO: Serialize R objects to JSON (JavaScript Object Notation). http://www.omegahat.org/RJSONIO, 2011. R package version 0.95.

  25. The JSON Schema Community. JSON schema: A JSON-based format for describing JSON data. http://json-schema.org/, 2011.

  26. 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.

  27. W3Schools, Inc. JSON tutorial. http://www.w3schools.com/json/default.asp, 2012.

  28. Jonathan Wallace. The libjson project: A JSON reader and writer. http://sourceforge.net/projects/libjson/, 2012.

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints 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

Publish with us

Policies and ethics