I'm having some problems with json-glib-1.0. As things went *very* pear
shaped when I tried to marshal an object I have I've limited myself a little.
Currently I'm working on the following short example:
using Json;
int main( string[] args ) {
Generator json_gen = new Generator();
Json.Node arr_node = new Json.Node( NodeType.ARRAY );
Json.Array arr = new Json.Array();
Json.Node obj_node = new Json.Node( NodeType.OBJECT );
Json.Object obj = new Json.Object();
Json.Node mem_node = new Json.Node( NodeType.VALUE );
mem_node.set_string( "hello" );
obj.add_member( "mem", mem_node.copy() );
obj_node.set_object( obj );
arr.add_element( obj_node.copy() );
arr_node.set_array( arr );
json_gen.set_root( arr_node.copy() );
json_gen.to_file( "test2.js" );
return( 0 );
}
Unfortunately it doesn't produce the expected result:
% cat test2.js
[ { "mem" : "" } ]
I was expecting to see "mem" have a value of "hello". I get a few errors when
running the binary, so I suspect somehing's not quite right:
(process:11711): GLib-GObject-WARNING **: gvalue.c:185: cannot initialize
GValue with type `gchararray', the value has already been initialized as
`gchararray'
Anyone with any ideas? /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe
Attachment:
signature.asc
Description: OpenPGP digital signature