This was done with a brute-force approach, ensuring no additional warnings from GCC 4.9 under x86_64.
New method to return a JSON representation of the element.