Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Caml-list] Announcing json-static: syntax magic for JSON

0 views
Skip to first unread message

Martin Jambon

unread,
Jan 20, 2007, 10:02:44 PM1/20/07
to caml...@inria.fr
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

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

0 new messages