Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Martin Jambon <martin.jambon@e...>
Subject: Announcing json-static: syntax magic for JSON
Hello,

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

   http://martin.jambon.free.fr/json-static.html
   (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 
signature:

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

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:

   http://martin.jambon.free.fr/yahoo.ml.html



Martin

--
Martin Jambon
http://martin.jambon.free.fr