How to create a new instance of a Godot object in C++?

Godot Version

4.4.1

Question

I’m writing an addon in GDExtension and am trying to figure out the C++ equivalent for the following GDScript:

var json:JSON = JSON.new()

Some older posts say I should try JSON::_new(), but that seems to not be present in the current release.

Looks like the following will work:

	Ref<JSON> json;
	json.instantiate();
2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.