Name:
Kasun Indrasiri
E-mail:
kasun147@gmail.com
kasun04@cse.mrt.ac.lk
Mentors
Jeff Garland (jeff@crystalclearsoftware.com)
Project Title
JSON Archives for Boost.serialization
Synopsis
JSON (JavaScript Object Notation [1]) is a lightweight computer data-interchange format which is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition. JSON is a text-based, human-readable format for representing simple data structures and associative arrays (i.e. objects).
The main objective of Boost.Serialization [2] is that the reversible deconstruction of an arbitrary set of C++ data structures to a sequence of bytes. Such a system can be used to reconstitute an equivalent structure in another program context. Depending on the context, this might used implement object persistence, remote parameter passing or other facility. The "archives" are used to denote a specific rendering of this stream of bytes. Boost.Serilization has different archive types [3] to support various data formats (XML etc.).
Boost.Serilization currently does not have an archive type that support JSON. Therefore the main objective of this project is to create an input and output archive type for JSON. This involves, parsing JSON and recreate objects as well as writing JSON formats.
In the context of parsing JSON, the most precise way of creating JSON parser is to use the Boost.Spirit[4]. Thus the ultimate goal of the project ‘JSON Archives for Boost.serialization’ is to create a json_oarchive and json_iarchive classes that provide serialization of JSON input and output.
- Project DeliverablesA JSON Obect model (json_om) to represents the JSON contexts programmatically. (JSON Object Model can hold either a JSON array, JSON object, string, integer, double, bool or null)
- An archive class json_iarchive which represents the JSON input archive type. The json_iarchive is based on Boost.Spirit and is capable of reading a given JSON format (Only the JSON formats generated by the serialization library are readable) and loading it to the JSON Object Model.
- An archive class json_oarchive which represents the JSON output archive type. The json_oarchive is also based on Boost.Spirit and its responsibility is to save data (from JSON Object Model) to an archive (analogous to output a JSON text format from a given JSON Object Model through oarchive).
- After completing the development, the library requires testing the different aspects of object serialization with each archive. In order to perform a complete test of the library, default bjam testing setup (which run several various test cases) will be used. .
Project Details
The Boost.serialization is used to the reversible deconstruction an arbitrary set of C++ data structures to a sequence of bytes. In the context of Boost.serialization, the archive types are used to specific rendering of a sequence of bytes (For instance, for the XML serialization xml input/output archives can be used). Therefore the main objective of this project is to develop an input and output archive types for JSON.
The serialization of JSON is quite important, because JSON is a popular lightweight computer data-interchange format which comprises of the clear and simple format that can easily be read by humans, that can easily parsed in nearly any programming language, and that still is a valid subset of the JavaScript programming language. Thus having archive types for Boost.serialization that supports JSON is a much needed functionality.
The main components of the project that needed to be implemented are the JSON archive types json_iarchive and json_oarchive which represents the JSON input archive type and output archive type respectively. Despite of the fact that the main goals of the project is to implement the input/output archive for JSON, the implementation of a JSON object model (json_om) is also a critical thing.
json_om : JSON Object model comprises of all the attributes and functionalities that are required to represent the JSON format programmatically. json_om mainly consists of data structures that can hold either, a JSON array, JSON object, string, integer, double, bool or null value.
json_iarchive: This is the JSON input archive for Boost.serilization which is based on Boost.Spirit. The json_iarchive is capable of loading data from a given JSON format to the JSON object model. The important thing is that the only JSON format that is readable to the json_iarchive is that the generated JSON format by the serialization library. The input archive must be derived from ‘template<class Archive>detail::common_iarchive’ and satisfy the minimum requirements of an input archive class (and may use the optional overrides).
json_oarchive: This is the JSON output archive for Boost.serialization which is based on Boost.Spirit. This is analogous to an output stream and json_oarchive is capable of saving or output JSON format (i.e. JSON text) based on Boost.Spirit. As same as json_iarchive this should obey the archive class hierarchy and also satisfy the minimum requirements of an output archive class.
(The Unicode support for JSON can be provided using std::wstring. There is no support for reading Unicode files and converting them to wstrings, as this is not a task specific to JSON).
Testing: The testing phase of the project consists of performing an exhaustive testing of the library. For the testing procedure the default bjam testing can be used and this testing comprises of 220 tests of the different aspects of object serialization with each archive. Since this should be a complete test, it is required to test the library with various different tests such as DLL vs static library and release vs debug.
Project Plan
My objective is to empower the Boost.serialization with the sterilization support for JSON by introducing JSON archive types. The main challenges of this project are to get familiar with JSON and implement a JSON parser based on Boost.Spirit parser generator. The basic concepts of Boost.serilization and archives are to be preserved and the development of the project should be based on the core concepts, conventions and tools of Boost libraries.
Project Schedule
- March 24th - April 14th: This period is dedicated to get familiarize with Boost community and JSON related technologies.
- April 15th – May 26th: Finalizing the design and architecture of the system and exchange the ideas with the Boost community through mailing lists. This also includes the direct interaction with the mentor through a preferred communication media. (Mostly through mails or Google talk). And getting more familiarize with Boost.Spirit/Boost.serilization.
- May 27th – July 5th: The development of JSON object model and JSON input archive (json_iarchive) is planned to be done during this period.
- July 5th – July 7th: Submitting mid term evaluation.
- July 7th – August 11th: The development of JSON output archive (json_oarchive) and the completing the test cases for the project.
- August 12th – August 18th: Preparing the documentation and bug fixes of the code.
- August 19th – September 1st: Finalizing and the submission of all the code, documentation and final evaluation.
Biography
I’m a Computer Science and Engineering undergraduate in Department of Computer Science and Engineering[5], University of Moratuwa [6], Sri Lanka. At the initial stages of my software engineering career I gained a considerable amount of knowledge through the Open Source projects and communities. I have had good exposure to C++ technologies in both windows (XP) and Linux platforms (including Ubuntu 7 and Solaris 10).
I’m so interested in Boost C++ products which offers wide range of facilities/libraries for ANSI C++ developers. I would like to contribute to the Boost projects through a Google Summer of Code 2008 project; JSON Archives for Boost.serialization. It’s a great pleasure to work and contribute to such a vast community like Boost through this project.
I started the contribution to the open source projects through Apache Software Foundation [7] through yet another JSON related product; JAxC [8]- JSON Support for Axis2/C [9]. I currently an active contributor (non-committer) Apache Rampart/C [10] which I already contributed through implementing Web Service Trust [11] module for Rampart/C.
I would like to get exposed more open source communities like Boost and to shape up my software engineering career during my academic life.
References
[1] JSON - http://www.json.org/
[2] Boost.serialization - http://www.boost.org/libs/serialization/doc/index.html
[3] Archive Types - http://www.boost.org/libs/serialization/doc/tutorial.html#archives
[4] Boost.Spirit - http://www.boost.org/libs/spirit/index.html
[5] Department of Computer Science & Engineering, UoM - http://www.cse.mrt.ac.lk
[6] University of Moratuwa, Sri Lanka - http://www.mrt.ac.lk
[7] Apache Software Foundation - www.apache.org
[8] JAxC – http://wiki.apache.org/ws/jaxc
[9]Axis2/C – http://ws.apache.org/axis2/c
[10] Rampart/C – http://ws.apache.org/rampart/c
[11] WS-Trust - www.ibm.com/developerworks/library/ws-trust/