There are many questions similar to this, however this is slightly different since it\'s about deep object property access, not just one level of depth.
$userJson = new MAChitgarha\Component\JSON(new User());
$userJson->set("foo", new Foo());
$userJson->set("foo.bar", "Hello World");
$userJson->get("foo.bar"); // Hello World