This is more a test of the tagging system. Jan answered a question from Wouter explaining a declaration detail, that is really useful to know.
:- use_module(library(http/json_convert)). :- json_object coord(x:float, y:float). :- json_object circle(center:coord/2). test:- prolog_to_json(circle(coord(3.4, 5.6)), JSON_Object), format(user_output, '~w', JSON_Object).
Note the arity added to qualify center
. With that
?- test. json([center=json([x=3.4,y=5.6])]) true.
I've simplified Wouter's question, removing type specifications...