Make first prototype of convertation to JSON, fix another bug with selecting elements.