Factorize code. Make sure a JSON gadget can contain child nodes.