Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

As per documentation, tj_encode accepts arrays, TJ objects, TJ booleans, and basic values. It does not accept maps, as there isn't even a way to tell that your value is a map, let alone tell which children of it might be maps.

So you'd want to do

var obj = tj_object("a",10, "b",50);
var json_string = tj_encode(map);
show_debug_message( "result: "+ json_string );

or

var obj = tj_object();
tj_set(obj, "a", 10);
tj_set(obj, "b", 50);
var json_string = tj_encode(map);
show_debug_message( "result: "+ json_string );
if you can describe your use case in more detail, I may have further recommendations.

Thank you for rapid reply.  Second one is exactly what I wanted!

What are differences between ds_map and tj_object?

Is it okay to replace all my maps to tj_object?

I didn't know that tj_set() can add new  values. 

I  found  out about this here.

Without that it was difficult to  work with the  extension.

Please add this info to the documentation for other people ...

Great extension!

tj_set is equivalent to ds_map_set, adding a new key-value pair or replacing an existing one. I'll see about updating the docs to be clearer.

Thanks! Your extensions are huge time savers :)