English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Announcing json-static: syntax magic for JSON
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-01-21 (03:00)
From: Martin Jambon <martin.jambon@e...>
Subject: Announcing json-static: syntax magic for JSON

I am releasing a syntax extension which translates quasi-OCaml type 
definitions into converters from/to generic JSON data:

   (version 0.9.0, BSD license)

JSON (JavaScript Object Notation) is a language-neutral data format, which 
is readily available in JavaScript, but also for many other 
programming languages thanks to its simplicity.

This tool uses the json-wheel library that Mika Illouz and myself released 
a few weeks ago. Using the json-static facility is not mandatory at all, 
but it can be a timesaver.

For example, the following declaration defines the type of a point object:

   type json point = < x: float; y: float >

This automatically makes two functions available, with the following 

   val json_of_point : point -> Json_type.t
   val point_of_json : Json_type.t -> point

Json_type.t is the type of any JSON data, as defined by the json-wheel 

A typical use of this library is illustrated by an HTTP client that 
queries a web service which returns JSON data. There is an example of a 
program that queries Yahoo!'s JSON web service:



Martin Jambon