I've got a duktape stack with the item on the top of the stack being effectively a JSON object, built with duk_push_string() / duk_put_prop_string().
My resulting object in javascript land is called 'obj', and I want to create a copy of obj, and store it within the same structure (a cached copy of the original data if you will).
i.e.
obj.id
obj.info
obj.orig.id
obj.orig.info
I though I may be able to do it by duplicating the entry at the top of the stack, then pushing it onto the stack like this:
duk_dup_top(ctx) ;
duk_put_prop_string(ctx, -2, "orig");
But when I run the program, I get a fatal error message: uncaught: 'cyclic input'
Any hints?
Ta, T
I can add json_data in with put_prop if I use duk_decode, but I can't find a way of getting JSON data out (i.e. converting the top to JSON in the first place).