Added JSON API functionality.