Add JSON encoder for the tag tree